summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-29 17:12:55 +0100
committerMax Kellermann <max@musicpd.org>2018-10-14 23:41:38 +0200
commit94592c14062d5afc9482d11baa401648082022c0 (patch)
tree8723d462737f883181fb1aaa3f91ee3d0add9721 /win32
parent13ce142df137f346526de2a31a7ccbd59a903cdd (diff)
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!
Diffstat (limited to 'win32')
-rwxr-xr-xwin32/build.py41
-rw-r--r--win32/meson.build1
-rw-r--r--win32/res/meson.build18
-rw-r--r--win32/res/mpd.rc.in2
4 files changed, 33 insertions, 29 deletions
diff --git a/win32/build.py b/win32/build.py
index 88d50b3a7..32027a64b 100755
--- a/win32/build.py
+++ b/win32/build.py
@@ -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)
diff --git a/win32/meson.build b/win32/meson.build
new file mode 100644
index 000000000..33b51d49c
--- /dev/null
+++ b/win32/meson.build
@@ -0,0 +1 @@
+subdir('res')
diff --git a/win32/res/meson.build b/win32/res/meson.build
new file mode 100644
index 000000000..4a9e536c4
--- /dev/null
+++ b/win32/res/meson.build
@@ -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)
diff --git a/win32/res/mpd.rc.in b/win32/res/mpd.rc.in
index 3a33e9981..3cf5850fc 100644
--- a/win32/res/mpd.rc.in
+++ b/win32/res/mpd.rc.in
@@ -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