Revert "Feature/meson (#1)" and reintroduce waf and the regular Makefile
A future re-introduction of meson support is to be put aside and not
instead of the other build systems
This reverts commit 11e7437095
.
This commit is contained in:
parent
de37569c92
commit
9061f7396f
|
@ -1,2 +1,4 @@
|
|||
/TAGS
|
||||
/.waf*
|
||||
/.lock-wscript
|
||||
/build
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
default:
|
||||
echo "use ./waf instead"
|
||||
|
||||
SOURCES = a2jmidid.c.* jack.c.* port.c.* port_thread.c.* port_hash.c.*
|
||||
#SOURCES += dbus.c.* dbus_iface_control.c.* dbus_iface_introspectable.c.*
|
||||
#SOURCES += paths.c.*
|
||||
#SOURCES += log.c.*
|
||||
|
||||
OMITS = --omit INIT_LIST_HEAD,list_empty,list_del,list_add_tail
|
||||
|
||||
# rebuild a2jmidid_call_graph.png
|
||||
cg:
|
||||
cd build && egypt $(OMITS) $(SOURCES) | dot -Tpng /dev/stdin > call_graph.png
|
||||
|
||||
cgf:
|
||||
cd build && egypt --include-external $(SOURCES) | dot -Tpng /dev/stdin > call_graph.png
|
|
@ -52,6 +52,7 @@
|
|||
#include "conf.h"
|
||||
#include "jack.h"
|
||||
#include "sigsegv.h"
|
||||
#include "gitversion.h"
|
||||
#include "dbus_iface_control.h"
|
||||
|
||||
#define MAIN_LOOP_SLEEP_INTERVAL 50 // in milliseconds
|
||||
|
@ -498,7 +499,7 @@ main(
|
|||
a2j_info("----------------------------");
|
||||
}
|
||||
|
||||
a2j_info("JACK MIDI <-> ALSA sequencer MIDI bridge, version " A2J_VERSION " built on %s", timestamp_str);
|
||||
a2j_info("JACK MIDI <-> ALSA sequencer MIDI bridge, version " A2J_VERSION " (" GIT_VERSION ") built on %s", timestamp_str);
|
||||
a2j_info("Copyright 2006,2007 Dmitry S. Baikov");
|
||||
a2j_info("Copyright 2007,2008,2009,2011,2012 Nedko Arnaudov");
|
||||
|
||||
|
|
10
config.h.in
10
config.h.in
|
@ -1,10 +0,0 @@
|
|||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
#define HAVE_ALSA 1
|
||||
#define HAVE_JACK 1
|
||||
#define HAVE_DBUS_1 @dbus@
|
||||
#define HAVE_GETOPT_H 1
|
||||
#define A2J_VERSION "@version@"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
if test $# -ne 1 -a $# -ne 2
|
||||
then
|
||||
echo "Usage: "`basename "$0"`" <file> [define_name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OUTPUT_FILE="`pwd`/${1}"
|
||||
TEMP_FILE="${OUTPUT_FILE}.tmp"
|
||||
|
||||
#echo version...
|
||||
#pwd
|
||||
#echo $OUTPUT_FILE
|
||||
#echo $TEMP_FILE
|
||||
|
||||
OLDPWD=`pwd`
|
||||
cd ..
|
||||
|
||||
if test $# -eq 2
|
||||
then
|
||||
DEFINE=${2}
|
||||
else
|
||||
DEFINE=GIT_VERSION
|
||||
fi
|
||||
|
||||
REV=$(git rev-parse HEAD)
|
||||
|
||||
test -z "$(git diff-index --name-only HEAD)" || REV="$REV-dirty"
|
||||
|
||||
echo "#define ${DEFINE} \"${REV}\"" > ${TEMP_FILE}
|
||||
if test ! -f ${OUTPUT_FILE}
|
||||
then
|
||||
echo "Generated ${OUTPUT_FILE} (${REV})"
|
||||
cp ${TEMP_FILE} ${OUTPUT_FILE}
|
||||
if test $? -ne 0; then exit 1; fi
|
||||
else
|
||||
if ! cmp -s ${OUTPUT_FILE} ${TEMP_FILE}
|
||||
then echo "Regenerated ${OUTPUT_FILE} (${REV})"
|
||||
cp ${TEMP_FILE} ${OUTPUT_FILE}
|
||||
if test $? -ne 0; then exit 1; fi
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "${OLDPWD}"
|
||||
|
||||
rm ${TEMP_FILE}
|
||||
|
||||
exit $?
|
111
meson.build
111
meson.build
|
@ -1,111 +0,0 @@
|
|||
project(
|
||||
'a2jmidid',
|
||||
'c',
|
||||
default_options: [
|
||||
'prefix=/usr/local',
|
||||
'b_pie=true',
|
||||
'b_lto=true'
|
||||
],
|
||||
meson_version: '>=0.50.0',
|
||||
license: 'GPL2+',
|
||||
version: '9')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
# dependency definitions
|
||||
dep_jack = dependency('jack')
|
||||
dep_alsa = dependency('alsa')
|
||||
lib_dl = cc.find_library('dl')
|
||||
lib_pthread = cc.find_library('pthread')
|
||||
deps_a2jmidid = [dep_alsa, dep_jack, lib_dl, lib_pthread]
|
||||
|
||||
# source definitions
|
||||
src_a2jmidi_bridge = ['a2jmidi_bridge.c']
|
||||
src_j2amidi_bridge = ['j2amidi_bridge.c']
|
||||
src_a2jmidid = [
|
||||
'a2jmidid.c',
|
||||
'log.c',
|
||||
'port.c',
|
||||
'port_thread.c',
|
||||
'port_hash.c',
|
||||
'paths.c',
|
||||
#'conf.c',
|
||||
'jack.c',
|
||||
'list.c']
|
||||
|
||||
# config.h input
|
||||
conf_data = configuration_data()
|
||||
conf_data.set('version', meson.project_version())
|
||||
|
||||
git = find_program('git', required : false)
|
||||
if git.found()
|
||||
git_version = run_command('git', 'describe', '--long', '--tags')
|
||||
if git_version.returncode() == 0
|
||||
conf_data.set('version', git_version.stdout().strip())
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('disable-dbus')
|
||||
conf_data.set10('dbus', false)
|
||||
else
|
||||
dep_dbus = dependency('dbus-1')
|
||||
deps_a2jmidid += [dep_dbus]
|
||||
dbus_data = configuration_data()
|
||||
dbus_data.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
|
||||
dbus_data.set('dbus_service_dir', join_paths(get_option('prefix'), 'share', 'dbus-1', 'services'))
|
||||
configure_file(
|
||||
input: 'org.gna.home.a2jmidid.service.in',
|
||||
output: 'org.gna.home.a2jmidid.service',
|
||||
install: true,
|
||||
install_dir: dbus_data.get('dbus_service_dir'),
|
||||
configuration: dbus_data
|
||||
)
|
||||
conf_data.set10('dbus', true)
|
||||
src_a2jmidid += [
|
||||
'dbus.c',
|
||||
'dbus_iface_introspectable.c',
|
||||
'dbus_iface_control.c',
|
||||
'sigsegv.c']
|
||||
install_man('man/a2j.1')
|
||||
install_man('man/a2j_control.1')
|
||||
configure_file(
|
||||
input: 'a2j',
|
||||
output: 'a2j',
|
||||
copy: true,
|
||||
install: true,
|
||||
install_dir: dbus_data.get('bindir'))
|
||||
configure_file(
|
||||
input: 'a2j_control',
|
||||
output: 'a2j_control',
|
||||
copy: true,
|
||||
install: true,
|
||||
install_dir: dbus_data.get('bindir'))
|
||||
endif
|
||||
|
||||
config_header = configure_file(
|
||||
input: 'config.h.in',
|
||||
output: 'config.h',
|
||||
configuration: conf_data)
|
||||
src_a2jmidid += [config_header]
|
||||
|
||||
# executables to compile
|
||||
executable(
|
||||
'a2jmidi_bridge',
|
||||
sources: src_a2jmidi_bridge,
|
||||
dependencies: [dep_alsa, dep_jack],
|
||||
install: true)
|
||||
executable(
|
||||
'j2amidi_bridge',
|
||||
sources: src_j2amidi_bridge,
|
||||
dependencies: [dep_alsa, dep_jack],
|
||||
install: true)
|
||||
executable(
|
||||
'a2jmidid',
|
||||
sources: src_a2jmidid,
|
||||
dependencies: deps_a2jmidid,
|
||||
install: true)
|
||||
|
||||
# installing man pages
|
||||
install_man('man/a2jmidi_bridge.1')
|
||||
install_man('man/a2jmidid.1')
|
||||
install_man('man/j2amidi_bridge.1')
|
|
@ -1 +0,0 @@
|
|||
option('disable-dbus', type: 'boolean', value: false, description: 'Disable D-Bus support (default: false)')
|
|
@ -1,3 +1,3 @@
|
|||
[D-BUS Service]
|
||||
Name=org.gna.home.a2jmidid
|
||||
Exec=@bindir@/a2jmidid dbus
|
||||
Exec=@BINDIR@/a2jmidid dbus
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,199 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import os
|
||||
from Configure import g_maxlen
|
||||
import Params
|
||||
import time
|
||||
import Task
|
||||
import re
|
||||
|
||||
APPNAME='a2jmidid'
|
||||
VERSION='8'
|
||||
|
||||
# these variables are mandatory ('/' are converted automatically)
|
||||
srcdir = '.'
|
||||
blddir = 'build'
|
||||
|
||||
def create_gitversion_gen(bld, header='gitversion.h', define=None):
|
||||
cmd = '../gitversion_regenerate.sh ${TGT}'
|
||||
if define:
|
||||
cmd += " " + define
|
||||
cls = Task.simple_task_type('gitversion', cmd, color='BLUE')
|
||||
cls.must_run = lambda self: True
|
||||
#cls.before = 'cxx'
|
||||
|
||||
def sg(self):
|
||||
rt = Params.h_file(self.m_outputs[0].abspath(self.env()))
|
||||
return rt
|
||||
cls.signature = sg
|
||||
|
||||
#def se(self):
|
||||
# r = sg(self)
|
||||
# return (r, r, r, r, r)
|
||||
#cls.cache_sig = property(sg, None)
|
||||
cls.cache_sig = None
|
||||
|
||||
tsk = cls('gitversion', bld.env().copy())
|
||||
tsk.m_inputs = []
|
||||
tsk.m_outputs = [bld.path.find_or_declare(header)]
|
||||
tsk.prio = 1 # execute this task first
|
||||
|
||||
def display_msg(msg, status = None, color = None):
|
||||
sr = msg
|
||||
global g_maxlen
|
||||
g_maxlen = max(g_maxlen, len(msg))
|
||||
if status:
|
||||
print "%s :" % msg.ljust(g_maxlen),
|
||||
Params.pprint(color, status)
|
||||
else:
|
||||
print "%s" % msg.ljust(g_maxlen)
|
||||
|
||||
def set_options(opt):
|
||||
opt.tool_options('compiler_cc')
|
||||
opt.add_option('--enable-pkg-config-dbus-service-dir', action='store_true', default=False, help='force D-Bus service install dir to be one returned by pkg-config')
|
||||
opt.add_option('--disable-dbus', action='store_true', default=False, help="Don't enable D-Bus support even if required dependencies are present")
|
||||
opt.add_option('--mandir', type='string', help="Manpage directory [Default: <prefix>/share/man]")
|
||||
|
||||
def configure(conf):
|
||||
conf.check_tool('compiler_cc')
|
||||
|
||||
conf.check_pkg('alsa', mandatory=True)
|
||||
conf.check_pkg('jack', vnum="0.109.0", mandatory=True)
|
||||
if not Params.g_options.disable_dbus:
|
||||
conf.check_pkg('dbus-1', mandatory=False, pkgvars=['session_bus_services_dir'])
|
||||
conf.env['DBUS_ENABLED'] = 'LIB_DBUS-1' in conf.env
|
||||
else:
|
||||
conf.env['DBUS_ENABLED'] = False
|
||||
|
||||
conf.env['LIB_DL'] = ['dl']
|
||||
conf.env['LIB_PTHREAD'] = ['pthread']
|
||||
|
||||
#conf.check_header('expat.h', mandatory=True)
|
||||
#conf.env['LIB_EXPAT'] = ['expat']
|
||||
conf.check_header('getopt.h', mandatory=True)
|
||||
|
||||
if conf.env['DBUS_ENABLED']:
|
||||
if Params.g_options.enable_pkg_config_dbus_service_dir:
|
||||
conf.env['DBUS_SERVICES_DIR'] = conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]
|
||||
else:
|
||||
conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
|
||||
|
||||
conf.check_tool('misc') # dbus service file subst tool
|
||||
|
||||
if Params.g_options.mandir:
|
||||
conf.env['MANDIR'] = Params.g_options.mandir
|
||||
else:
|
||||
conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man'
|
||||
|
||||
conf.define('A2J_VERSION', VERSION)
|
||||
conf.write_config_header('config.h')
|
||||
|
||||
gitrev = None
|
||||
if os.access('gitversion.h', os.R_OK):
|
||||
data = file('gitversion.h').read()
|
||||
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
|
||||
if m != None:
|
||||
gitrev = m.group(1)
|
||||
|
||||
print
|
||||
display_msg("==================")
|
||||
version_msg = "a2jmidid-" + VERSION
|
||||
if gitrev:
|
||||
version_msg += " exported from " + gitrev
|
||||
else:
|
||||
version_msg += " git revision will checked and eventually updated during build"
|
||||
print version_msg
|
||||
print
|
||||
|
||||
display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
|
||||
if conf.env['DBUS_ENABLED']:
|
||||
have_dbus_status = "yes"
|
||||
else:
|
||||
have_dbus_status = "no"
|
||||
display_msg("D-Bus support", have_dbus_status)
|
||||
if conf.env['DBUS_ENABLED']:
|
||||
display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
|
||||
if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]:
|
||||
print
|
||||
print Params.g_colors['RED'] + "WARNING: D-Bus session services directory as reported by pkg-config is"
|
||||
print Params.g_colors['RED'] + "WARNING:",
|
||||
print Params.g_colors['CYAN'] + conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]
|
||||
print Params.g_colors['RED'] + 'WARNING: but service file will be installed in'
|
||||
print Params.g_colors['RED'] + "WARNING:",
|
||||
print Params.g_colors['CYAN'] + conf.env['DBUS_SERVICES_DIR']
|
||||
print Params.g_colors['RED'] + 'WARNING: You may need to adjust your D-Bus configuration after installing'
|
||||
print 'WARNING: You can override dbus service install directory'
|
||||
print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
|
||||
print Params.g_colors['NORMAL'],
|
||||
print
|
||||
|
||||
def build(bld):
|
||||
if not os.access('gitversion.h', os.R_OK):
|
||||
create_gitversion_gen(bld)
|
||||
|
||||
prog = bld.create_obj('cc', 'program')
|
||||
prog.source = [
|
||||
'a2jmidid.c',
|
||||
'log.c',
|
||||
'port.c',
|
||||
'port_thread.c',
|
||||
'port_hash.c',
|
||||
'paths.c',
|
||||
#'conf.c',
|
||||
'jack.c',
|
||||
'list.c',
|
||||
]
|
||||
|
||||
if bld.env()['DBUS_ENABLED']:
|
||||
prog.source.append('dbus.c')
|
||||
prog.source.append('dbus_iface_introspectable.c')
|
||||
prog.source.append('dbus_iface_control.c')
|
||||
prog.source.append('sigsegv.c')
|
||||
|
||||
prog.includes = '.' # make waf dependency tracking work
|
||||
prog.target = 'a2jmidid'
|
||||
prog.uselib = 'ALSA JACK DL PTHREAD'
|
||||
if bld.env()['DBUS_ENABLED']:
|
||||
prog.uselib += " DBUS-1"
|
||||
prog = bld.create_obj('cc', 'program')
|
||||
prog.source = 'a2jmidi_bridge.c'
|
||||
prog.target = 'a2jmidi_bridge'
|
||||
prog.uselib = 'ALSA JACK'
|
||||
|
||||
prog = bld.create_obj('cc', 'program')
|
||||
prog.source = 'j2amidi_bridge.c'
|
||||
prog.target = 'j2amidi_bridge'
|
||||
prog.uselib = 'ALSA JACK'
|
||||
|
||||
if bld.env()['DBUS_ENABLED']:
|
||||
# process org.gna.home.a2jmidid.service.in -> org.gna.home.a2jmidid.service
|
||||
obj = bld.create_obj('subst')
|
||||
obj.source = 'org.gna.home.a2jmidid.service.in'
|
||||
obj.target = 'org.gna.home.a2jmidid.service'
|
||||
obj.dict = {'BINDIR': bld.env()['PREFIX'] + '/bin'}
|
||||
obj.inst_var = bld.env()['DBUS_SERVICES_DIR']
|
||||
obj.inst_dir = '/'
|
||||
|
||||
install_files('PREFIX', 'bin', 'a2j_control', chmod=0755)
|
||||
install_files('PREFIX', 'bin', 'a2j', chmod=0755)
|
||||
|
||||
# install man pages
|
||||
man_pages = [
|
||||
"a2jmidi_bridge.1",
|
||||
"a2jmidid.1",
|
||||
"j2amidi_bridge.1",
|
||||
]
|
||||
|
||||
if bld.env()['DBUS_ENABLED']:
|
||||
man_pages.append("a2j.1")
|
||||
man_pages.append("a2j_control.1")
|
||||
|
||||
for i in range(len(man_pages)):
|
||||
man_pages[i] = "man/" + man_pages[i]
|
||||
|
||||
install_files('MANDIR', 'man1', man_pages)
|
||||
|
||||
def dist_hook():
|
||||
os.remove('gitversion_regenerate.sh')
|
||||
os.system('../gitversion_regenerate.sh gitversion.h')
|
Loading…
Reference in New Issue