switch to meson (#30)

switch to a meson-based build system
This commit is contained in:
Alexander Epaneshnikov 2021-06-19 05:53:04 +03:00 committed by GitHub
commit 0c09fe5449
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 96 additions and 48 deletions

4
.gitignore vendored
View file

@ -1,3 +1 @@
espeakup
src/*.d
src/*.o
build*

View file

@ -1,37 +0,0 @@
PREFIX = /usr/local
BINDIR = ${PREFIX}/bin
MANDIR = ${PREFIX}/share/man
SRC_DIR = src
DEPFLAGS = -MMD
WARNFLAGS = -Wall -Wpedantic \
-Wextra
CFLAGS += ${DEPFLAGS} ${WARNFLAGS}
LDLIBS = -lespeak-ng -lpthread -lasound -lm
INSTALL = install
BINMODE = 0755
MANMODE = 0644
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJECTS := $(patsubst %.c,%.o,$(wildcard $(SRC_DIR)/*.c))
all: espeakup
install: espeakup
${INSTALL} -d ${DESTDIR}${BINDIR}
${INSTALL} -m ${BINMODE} $< ${DESTDIR}${BINDIR}
${INSTALL} -d ${DESTDIR}${MANDIR}/man8
${INSTALL} -m ${MANMODE} doc/espeakup.8 ${DESTDIR}${MANDIR}/man8
espeakup: ${OBJECTS}
cc $(LDLIBS) -o ./espeakup $(OBJECTS)
clean:
${RM} $(SRC_DIR)/*.d $(SRC_DIR)/*.o
distclean: clean
${RM} espeakup
-include ${SRCS:.c=.d}

View file

@ -18,9 +18,15 @@ is beyond the scope of this document.
The preferred way to install espeakup is using your distribution's
packaging system, but if your distribution does not have a package for
espeakup yet, espeakup just uses a Makefile, so you should be able to
change to the source directory, then type make, then as root, make
install.
espeakup yet, espeakup just uses meson, so you should be able to
change to the source directory, then type:
```bash
meson . ./build
cd ./build
ninja
sudo ninja install
```
## Starting Up

1
doc/meson.build Normal file
View file

@ -0,0 +1 @@
install_man('espeakup.8')

21
meson.build Normal file
View file

@ -0,0 +1,21 @@
project('espeakup', 'c',
default_options : ['buildtype=debugoptimized', 'c_std=gnu11', 'warning_level=3'],
license : 'GPL-3.0-or-later',
version : '0.81',
meson_version : '>=0.47.0')
cc = meson.get_compiler('c')
thread_dep = dependency('threads')
espeak_dep = dependency('espeak-ng')
alsa_dep = dependency('alsa')
math_dep = cc.find_library('m', required : false)
subdir('doc')
subdir('services')
subdir('src')
executable('espeakup',
espeakup_version,
espeakup_sources,
dependencies : [thread_dep, espeak_dep, alsa_dep, math_dep],
install : true)

2
meson_options.txt Normal file
View file

@ -0,0 +1,2 @@
option('systemd', type : 'feature', value : 'auto',
description :'enable systemd support')

4
services/meson.build Normal file
View file

@ -0,0 +1,4 @@
systemd = dependency('systemd', required: get_option('systemd'))
if systemd.found()
subdir('systemd')
endif

View file

@ -1 +0,0 @@
default_voice=

View file

@ -6,10 +6,10 @@ After=systemd-udev-settle.service sound.target
[Service]
Type=forking
EnvironmentFile=/etc/conf.d/espeakup
PIDFile=/run/espeakup.pid
ExecStartPre=+/sbin/modprobe speakup_soft
ExecStart=/usr/bin/espeakup --default-voice=${default_voice}
Environment="default_voice="
ExecStartPre=+modprobe speakup_soft
ExecStart=@bindir@/espeakup --default-voice=${default_voice}
ExecReload=kill -HUP $MAINPID
Restart=always

View file

@ -0,0 +1,17 @@
unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
prefixdir = get_option('prefix')
bindir = join_paths(prefixdir, get_option('bindir'))
unit_conf = configuration_data()
unit_conf.set('bindir', bindir)
service_file = configure_file(
input : 'espeakup.service.in',
output : 'espeakup.service',
configuration : unit_conf
)
install_data(service_file,
install_dir : unitdir
)

View file

@ -23,6 +23,7 @@
#include <string.h>
#include "espeakup.h"
#include "version.h"
/* pid path */
extern char *pidPath;

View file

@ -28,7 +28,6 @@
#include "queue.h"
#define PACKAGE_VERSION "0.81"
#define PACKAGE_BUGREPORT "https://github.com/linux-speakup/espeakup/issues"
enum espeakup_mode_t {

12
src/meson.build Normal file
View file

@ -0,0 +1,12 @@
espeakup_version = vcs_tag(input : 'version.h.in', output : 'version.h')
espeakup_sources = files([
'cli.c',
'espeak.c',
'espeakup.c',
'queue.c',
'signal.c',
'softsynth.c',
'stringhandling.c'
])

25
src/version.h.in Normal file
View file

@ -0,0 +1,25 @@
/*
* espeakup - interface which allows speakup to use espeak
*
* Copyright (C) 2008 William Hubbs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __VERSION_H
#define __VERSION_H
#define PACKAGE_VERSION "@VCS_TAG@"
#endif