build with Meson instead of autotools
So long, autotools! This is my last MPD related project to migrate away from it. It has its strengths, but also very obvious weaknesses and weirdnesses. Today, many of its quirks are not needed anymore, and are cumbersome and slow. Now welcome our new Meson overlords!
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import os, os.path
|
||||
import sys, subprocess
|
||||
import shutil
|
||||
|
||||
configure_args = sys.argv[1:]
|
||||
|
||||
@@ -73,7 +74,15 @@ class CrossGccToolchain:
|
||||
|
||||
# redirect pkg-config to use our root directory instead of the
|
||||
# default one on the build host
|
||||
self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig')
|
||||
import shutil
|
||||
bin_dir = os.path.join(install_prefix, 'bin')
|
||||
try:
|
||||
os.makedirs(bin_dir)
|
||||
except:
|
||||
pass
|
||||
self.pkg_config = shutil.copy(os.path.join(mpd_path, 'build', 'pkg-config.sh'),
|
||||
os.path.join(bin_dir, 'pkg-config'))
|
||||
self.env['PKG_CONFIG'] = self.pkg_config
|
||||
|
||||
# a list of third-party libraries to be used by MPD on Android
|
||||
from build.libs import *
|
||||
@@ -103,30 +112,6 @@ for x in thirdparty_libs:
|
||||
|
||||
# configure and build MPD
|
||||
|
||||
configure = [
|
||||
os.path.join(mpd_path, 'configure'),
|
||||
'CC=' + toolchain.cc,
|
||||
'CXX=' + toolchain.cxx,
|
||||
'CFLAGS=' + toolchain.cflags,
|
||||
'CXXFLAGS=' + toolchain.cxxflags,
|
||||
'CPPFLAGS=' + toolchain.cppflags,
|
||||
'LDFLAGS=' + toolchain.ldflags + ' -static',
|
||||
'LIBS=' + toolchain.libs,
|
||||
'AR=' + toolchain.ar,
|
||||
'RANLIB=' + toolchain.ranlib,
|
||||
'STRIP=' + toolchain.strip,
|
||||
'--host=' + toolchain.arch,
|
||||
'--prefix=' + toolchain.install_prefix,
|
||||
|
||||
'--enable-silent-rules',
|
||||
|
||||
'--disable-icu',
|
||||
|
||||
] + configure_args
|
||||
|
||||
from build.cmdline import concatenate_cmdline_variables
|
||||
configure = concatenate_cmdline_variables(configure,
|
||||
set(('CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'LIBS')))
|
||||
|
||||
subprocess.check_call(configure, env=toolchain.env)
|
||||
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], env=toolchain.env)
|
||||
from build.meson import configure as run_meson
|
||||
run_meson(toolchain, mpd_path, '.', configure_args)
|
||||
subprocess.check_call(['/usr/bin/ninja'], env=toolchain.env)
|
||||
|
1
win32/meson.build
Normal file
1
win32/meson.build
Normal file
@@ -0,0 +1 @@
|
||||
subdir('res')
|
18
win32/res/meson.build
Normal file
18
win32/res/meson.build
Normal file
@@ -0,0 +1,18 @@
|
||||
windows_conf = configuration_data()
|
||||
windows_conf.set('VERSION', meson.project_version())
|
||||
|
||||
splitted_version = meson.project_version().split('.')
|
||||
windows_conf.set('VERSION_MAJOR', splitted_version[0])
|
||||
windows_conf.set('VERSION_MINOR', splitted_version.get(1, '0'))
|
||||
windows_conf.set('VERSION_REVISION', splitted_version.get(2, '0'))
|
||||
windows_conf.set('VERSION_EXTRA', splitted_version.get(3, '0'))
|
||||
windows_conf.set('srcdir', meson.current_source_dir())
|
||||
|
||||
mpd_rc = configure_file(
|
||||
input: 'mpd.rc.in',
|
||||
output: 'mpd.rc',
|
||||
configuration: windows_conf,
|
||||
)
|
||||
|
||||
windows_mod = import('windows')
|
||||
windows_resources = windows_mod.compile_resources(mpd_rc)
|
@@ -3,7 +3,7 @@
|
||||
#define VERSION_NUMBER @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,@VERSION_EXTRA@
|
||||
#define VERSION_NUMBER_STR "@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,@VERSION_EXTRA@"
|
||||
|
||||
MPD_ICON ICON "@top_srcdir@/win32/res/mpd.ico"
|
||||
MPD_ICON ICON "@srcdir@/mpd.ico"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILETYPE VFT_APP
|
||||
|
Reference in New Issue
Block a user