From 5a841ef4624ef4b776e578af80d2397241754b00 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 22 Jan 2020 00:47:33 +0100 Subject: [PATCH] Tweaks to build/package scripts for new waf * Windows: delete waf installed .dll.a files * Windows: override waf's conf.env.LIBDIR = conf.env.BINDIR with explicit --libdir * Windows: fix asm (`x86_64-w64-mingw32-as` -D flag is for debug messages, -D defines are not available) * Mac: override waf adding -install_name (and -Wl,-compatibility_version -Wl,-current_version) by moving -dynamiclib from linkflags to ldflags * Mac: Allow libs with compat version number suffix (not needed anymore, but may help in the future) --- libs/ardour/wscript | 7 ++++++- tools/osx_packaging/osx_build | 2 +- tools/x-win/compile.sh | 3 ++- tools/x-win/package.sh | 1 + wscript | 17 +++++++++++++++++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 3da991be71..7376bec868 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -1,6 +1,6 @@ #!/usr/bin/env python from waflib.extras import autowaf as autowaf -from waflib import Options +from waflib import Options, Task, Tools import os import sys import re @@ -373,6 +373,11 @@ def build(bld): # micro increment <=> no interface changes LIBARDOUR_LIB_VERSION = "3.0.0" + # remove '${DEFINES_ST:DEFINES}' from run_str. + # x86_64-w64-mingw32-as (mingw) -D flag is for debug messages + if bld.env['build_target'] == 'mingw': + class asm(Task.classes['asm']): run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}' + # operate on copy to avoid adding sources twice sources = list(libardour_sources) diff --git a/tools/osx_packaging/osx_build b/tools/osx_packaging/osx_build index f890cfe971..df6a2864a7 100755 --- a/tools/osx_packaging/osx_build +++ b/tools/osx_packaging/osx_build @@ -472,7 +472,7 @@ while [ true ] ; do strip -u -r -arch all $file &>/dev/null fi - deps=`otool -L $file | awk '{print $1}' | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | grep -v 'libjack\.' | grep -v "$(basename $file)"` + deps=`otool -L $file | awk '{print $1}' | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | grep -v 'libjack\.' | egrep -v "$(basename $file .dylib).*.dylib"` # echo -n "." for dep in $deps ; do base=`basename $dep` diff --git a/tools/x-win/compile.sh b/tools/x-win/compile.sh index 6f8e141685..00fe2737e2 100755 --- a/tools/x-win/compile.sh +++ b/tools/x-win/compile.sh @@ -81,7 +81,8 @@ DEPSTACK_ROOT="$PREFIX" \ --dist-target=mingw \ --also-include=${PREFIX}/include \ $ARDOURCFG \ - --prefix=${PREFIX} + --prefix=${PREFIX} \ + --libdir=${PREFIX}/lib ./waf ${CONCURRENCY} diff --git a/tools/x-win/package.sh b/tools/x-win/package.sh index 3dbfa6c248..dfbea0978a 100755 --- a/tools/x-win/package.sh +++ b/tools/x-win/package.sh @@ -202,6 +202,7 @@ cp gtk2_ardour/icons/cursor_square/* $DESTDIR/share/${LOWERCASE_DIRNAME}/icons/ # clean build-dir after depoyment echo " === bundle completed, cleaning up" ./waf uninstall +find $DESTDIR -name "*.dll.a" | xargs rm echo " === complete" du -sh $DESTDIR diff --git a/wscript b/wscript index e1beb6a86d..b0d60e59bb 100644 --- a/wscript +++ b/wscript @@ -943,6 +943,12 @@ def configure(conf): conf.env.append_value ('CXXFLAGS', '-DSILENCE_AFTER') conf.define ('FREEBIE', 1) + # set explicit LIBDIR, otherwise mingw/windows builds use + # conf.env.LIBDIR = conf.env.BINDIR and `waf install` fails + # because $BINDIR/ardour6 is the main binary, and $LIBDIR/ardour6/ a directory + if Options.options.libdir: + conf.env.LIBDIR = Options.options.libdir + if Options.options.lv2dir: conf.env['LV2DIR'] = Options.options.lv2dir else: @@ -1299,6 +1305,17 @@ int main () { return 0; } # Fix utterly braindead FLAC include path to not smash assert.h conf.env['INCLUDES_FLAC'] = [] + if sys.platform == 'darwin': + # override waf's -install_name added in + # waflib/Tools/ccroot.py when -dynamiclib is used + if conf.env.LINKFLAGS_cshlib: + conf.env.LINKFLAGS_cshlib = []; + conf.env.LDFLAGS_cshlib = ['-dynamiclib'] + + if conf.env.LINKFLAGS_cxxshlib: + conf.env.LINKFLAGS_cxxshlib = []; + conf.env.LDFLAGS_cxxshlib = ['-dynamiclib'] + config_text = open('libs/ardour/config_text.cc', "w") config_text.write('''#include "ardour/ardour.h" namespace ARDOUR {