From 51cf6ab29e8e1bff3dd75ed26f71beaac037a79f Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 8 Dec 2023 18:54:36 +0100 Subject: [PATCH] Fix lv2 ttl gen step in a proper way for meson Signed-off-by: falkTX --- .github/workflows/build.yml | 5 +++-- meson.build | 6 ++++-- ports-juce5/meson.build | 11 ++--------- ports-juce6.0/meson.build | 13 +++---------- ports-juce6.1/meson.build | 13 +++---------- ports-juce7/meson.build | 11 +++-------- scripts/generate-ttl.sh | 35 +++++++++++++++++++++++++++++++++++ 7 files changed, 53 insertions(+), 41 deletions(-) create mode 100755 scripts/generate-ttl.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 967d5b83..cd35a81f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,10 +43,10 @@ jobs: ./.github/workflows/bootstrap-deps.sh ${{ matrix.target }} - name: Build env: - LDFLAGS: -static-libgcc -static-libstdc++ + #LDFLAGS: -static-libgcc -static-libstdc++ PKG_CONFIG_PATH: /usr/lib/${{ matrix.pkgprefix }}/pkgconfig run: | - meson build --buildtype=release --prefix=/usr --cross-file scripts/meson/${{ matrix.target }}.ini + meson setup build --buildtype=release --prefix=/usr --cross-file scripts/meson/${{ matrix.target }}.ini ninja -C build - name: Install run: | @@ -96,6 +96,7 @@ jobs: apt-get install -yqq \ binfmt-support \ build-essential \ + file \ git \ meson \ pkg-config \ diff --git a/meson.build b/meson.build index 6027e5ca..6a0a6788 100644 --- a/meson.build +++ b/meson.build @@ -1,8 +1,10 @@ ############################################################################### project('DISTRHO-Ports', - 'c', 'cpp', - license : 'GPLv3' + ['c', 'cpp'], + license : 'GPLv3', + meson_version: '>=0.55.0', + version: '1', ) ############################################################################### diff --git a/ports-juce5/meson.build b/ports-juce5/meson.build index a45b18d7..318dd00c 100644 --- a/ports-juce5/meson.build +++ b/ports-juce5/meson.build @@ -250,17 +250,10 @@ if build_lv2 or build_vst2 link_with: link_with_plugin, ) - plugin_lv2_dir = meson.current_build_dir() / plugin_name + '.lv2' - - plugin_lv2_ttl = custom_target(plugin_name + '_lv2-ttl', + custom_target(plugin_name + '_lv2-dir', output: plugin_name + '.lv2', input: plugin_lv2_lib, - command: [ - 'mkdir', '-p', plugin_lv2_dir, '&&', - 'cd', plugin_lv2_dir, '&&', - 'cp', plugin_lv2_lib.full_path(), plugin_lv2_dir / plugin_name + lib_suffix, '&&', - (os_windows ? 'wine' : 'env'), lv2_ttl_generator, '.' / plugin_name + lib_suffix, - ], + command: [ '../scripts/generate-ttl.sh', lv2_ttl_generator, '@OUTPUT@', plugin_lv2_lib.full_path() ], install: true, install_dir: lv2dir, ) diff --git a/ports-juce6.0/meson.build b/ports-juce6.0/meson.build index f6384127..24880448 100644 --- a/ports-juce6.0/meson.build +++ b/ports-juce6.0/meson.build @@ -187,17 +187,10 @@ foreach plugin : plugins link_with: [ lib_juce60, plugin_lib ], ) - plugin_lv2_dir = meson.current_build_dir() / plugin_name + '.lv2' - - plugin_lv2_ttl = custom_target(plugin_name + '_lv2-ttl', + custom_target(plugin_name + '_lv2-dir', output: plugin_name + '.lv2', input: plugin_lv2_lib, - command: [ - 'mkdir', '-p', plugin_lv2_dir, '&&', - 'cd', plugin_lv2_dir, '&&', - 'mv', plugin_lv2_lib.full_path(), plugin_lv2_dir / plugin_name + lib_suffix, '&&', - (os_windows ? 'wine' : 'env'), lv2_ttl_generator, '.' / plugin_name + lib_suffix, - ], + command: [ '../scripts/generate-ttl.sh', lv2_ttl_generator, '@OUTPUT@', plugin_lv2_lib.full_path() ], install: true, install_dir: lv2dir, ) @@ -244,7 +237,7 @@ foreach plugin : plugins command: [ 'mkdir', '-p', plugin_vst3_dir, '&&', 'cd', plugin_vst3_dir, '&&', - 'mv', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix, + 'cp', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix, ], install: true, install_dir: vst3dir, diff --git a/ports-juce6.1/meson.build b/ports-juce6.1/meson.build index ef7d5394..7e29ad81 100644 --- a/ports-juce6.1/meson.build +++ b/ports-juce6.1/meson.build @@ -194,17 +194,10 @@ foreach plugin : plugins link_with: [ lib_juce6, plugin_lib ], ) - plugin_lv2_dir = meson.current_build_dir() / plugin_name + '.lv2' - - plugin_lv2_ttl = custom_target(plugin_name + '_lv2-ttl', + custom_target(plugin_name + '_lv2-dir', output: plugin_name + '.lv2', input: plugin_lv2_lib, - command: [ - 'mkdir', '-p', plugin_lv2_dir, '&&', - 'cd', plugin_lv2_dir, '&&', - 'mv', plugin_lv2_lib.full_path(), plugin_lv2_dir / plugin_name + lib_suffix, '&&', - (os_windows ? 'wine' : 'env'), lv2_ttl_generator, '.' / plugin_name + lib_suffix, - ], + command: [ '../scripts/generate-ttl.sh', lv2_ttl_generator, '@OUTPUT@', plugin_lv2_lib.full_path() ], install: true, install_dir: lv2dir, ) @@ -251,7 +244,7 @@ foreach plugin : plugins command: [ 'mkdir', '-p', plugin_vst3_dir, '&&', 'cd', plugin_vst3_dir, '&&', - 'mv', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix, + 'cp', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix, ], install: true, install_dir: vst3dir, diff --git a/ports-juce7/meson.build b/ports-juce7/meson.build index 6fe2b9b4..3e27e9fd 100644 --- a/ports-juce7/meson.build +++ b/ports-juce7/meson.build @@ -180,15 +180,10 @@ foreach plugin : plugins plugin_lv2_dir = meson.current_build_dir() / plugin_name + '.lv2' - plugin_lv2_ttl = custom_target(plugin_name + '_lv2-ttl', + custom_target(plugin_name + '_lv2-dir', output: plugin_name + '.lv2', input: plugin_lv2_lib, - command: [ - 'mkdir', '-p', plugin_lv2_dir, '&&', - 'cd', plugin_lv2_dir, '&&', - 'mv', plugin_lv2_lib.full_path(), plugin_lv2_dir / plugin_name + lib_suffix, '&&', - (os_windows ? 'wine' : 'env'), lv2_ttl_generator, '.' / plugin_name + lib_suffix, - ], + command: [ '../scripts/generate-ttl.sh', lv2_ttl_generator, '@OUTPUT@', plugin_lv2_lib.full_path() ], install: true, install_dir: lv2dir, ) @@ -235,7 +230,7 @@ foreach plugin : plugins command: [ 'mkdir', '-p', plugin_vst3_dir, '&&', 'cd', plugin_vst3_dir, '&&', - 'mv', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix, + 'cp', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix, ], install: true, install_dir: vst3dir, diff --git a/scripts/generate-ttl.sh b/scripts/generate-ttl.sh new file mode 100755 index 00000000..689dc600 --- /dev/null +++ b/scripts/generate-ttl.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e + +gen="${1}" +dir="${2}" +lib="${3}" + +# meson does not support MESON_EXE_WRAPPER for post-build commands, only for tests +# do a whole dance to try to replicate expected behaviour +if [ -z "${MESON_EXE_WRAPPER}" ]; then + fileout="$(file "${gen}")" + if echo "${fileout}" | grep -q "PE32 executable.*Intel 80386"; then + MESON_EXE_WRAPPER="wine" + elif echo "${fileout}" | grep -q "PE32+ executable.*x86-64"; then + MESON_EXE_WRAPPER="wine64" + elif echo "${fileout}" | grep -q "ARM aarch64"; then + MESON_EXE_WRAPPER="qemu-aarch64-static -L /usr/lib/aarch64-linux-gnu" + elif echo "${fileout}" | grep -q "ARM"; then + MESON_EXE_WRAPPER="qemu-arm-static -L /usr/lib/arm-linux-gnueabihf" + elif echo "${fileout}" | grep -q "Intel 80386"; then + MESON_EXE_WRAPPER="qemu-i386-static -L /usr/lib/i386-linux-gnu" + elif echo "${fileout}" | grep -q "RISC-V"; then + MESON_EXE_WRAPPER="qemu-riscv64-static -L /usr/lib/riscv64-linux-gnu" +# elif echo "${fileout}" | grep -q "x86-64"; then +# MESON_EXE_WRAPPER="qemu-x86_64-static -L /usr/lib/x86_64-linux-gnu" + else + echo "unrecognized file output: ${fileout}" +# exit 1 + fi +fi + +mkdir -p "${dir}" +cd "${dir}" +exec ${MESON_EXE_WRAPPER} "${gen}" "${lib}"