From 042707a6339cff6795d8d2ea08f927924f218a7b Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 22 Nov 2018 17:17:21 +0100 Subject: Avoid invalid qmake code in macOS-specific pluginloader test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You cannot manipulate variables in custom target dependencies, so the following code was invalid: i386_d.depends = EXPORT_VALID_ARCHS=i386 In order to still build the fat binary, we split the project in four, one for each architecture, plus one to create the final package. Change-Id: If08cf54e2e4098a7e10df41b7ea8d2bf699f58be Reviewed-by: Oswald Buddenhagen Reviewed-by: Tor Arne Vestbø --- .../plugin/qpluginloader/machtest/machtest.pri | 13 ++++ .../plugin/qpluginloader/machtest/machtest.pro | 73 ++++------------------ .../plugin/qpluginloader/machtest/machtest_fat.pro | 41 ++++++++++++ .../qpluginloader/machtest/machtest_i386.pro | 3 + .../qpluginloader/machtest/machtest_ppc64.pro | 9 +++ .../qpluginloader/machtest/machtest_x86_64.pro | 2 + 6 files changed, 80 insertions(+), 61 deletions(-) create mode 100644 tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri create mode 100644 tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro create mode 100644 tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro create mode 100644 tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro create mode 100644 tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri new file mode 100644 index 0000000000..ca4a0a07e9 --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri @@ -0,0 +1,13 @@ +TEMPLATE = aux + +# Needs explicit load()ing due to aux template. Relies on QT being non-empty. +load(qt) + +goodlib.target = good.$${QMAKE_APPLE_DEVICE_ARCHS}.dylib +goodlib.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $< +goodlib.depends += $$PWD/../fakeplugin.cpp + +all.depends += goodlib + +QMAKE_EXTRA_TARGETS += goodlib all +QMAKE_CLEAN += $$goodlib.target diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro index 7f7caa7f76..795dd89895 100644 --- a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro +++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro @@ -1,64 +1,15 @@ -TEMPLATE = aux -OTHER_FILES += \ - ppcconverter.pl \ - generate-bad.pl +TEMPLATE = subdirs -# Needs explicit load()ing due to aux template. Relies on QT being non-empty. -load(qt) - -i386_d.target = good.i386.dylib -i386_d.depends = EXPORT_VALID_ARCHS=i386 -i386.target = good.i386.dylib -i386.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $< -i386.depends += $$PWD/../fakeplugin.cpp - -x86_64_d.target = good.x86_64.dylib -x86_64_d.depends = EXPORT_VALID_ARCHS=x86_64 -x86_64.target = good.x86_64.dylib -x86_64.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $< -x86_64.depends += $$PWD/../fakeplugin.cpp - -# Current Mac OS X toolchains have no compiler for PPC anymore -# So we fake it by converting an x86-64 binary to (little-endian!) PPC64 -ppc64.target = good.ppc64.dylib -ppc64.commands = $$PWD/ppcconverter.pl $< $@ -ppc64.depends = x86_64 $$PWD/ppcconverter.pl - -# Generate a fat binary with three architectures -fat_all.target = good.fat.all.dylib -fat_all.commands = lipo -create -output $@ \ - -arch ppc64 $$ppc64.target \ - -arch i386 $$i386.target \ - -arch x86_64 $$x86_64.target -fat_all.depends += i386 x86_64 ppc64 - -fat_no_i386.target = good.fat.no-i386.dylib -fat_no_i386.commands = lipo -create -output $@ -arch x86_64 $$x86_64.target -arch ppc64 $$ppc64.target -fat_no_i386.depends += x86_64 ppc64 - -fat_no_x86_64.target = good.fat.no-x86_64.dylib -fat_no_x86_64.commands = lipo -create -output $@ -arch i386 $$i386.target -arch ppc64 $$ppc64.target -fat_no_x86_64.depends += i386 ppc64 - -fat_stub_i386.target = good.fat.stub-i386.dylib -fat_stub_i386.commands = lipo -create -output $@ -arch ppc64 $$ppc64.target -arch_blank i386 -fat_stub_i386.depends += x86_64 ppc64 - -fat_stub_x86_64.target = good.fat.stub-x86_64.dylib -fat_stub_x86_64.commands = lipo -create -output $@ -arch ppc64 $$ppc64.target -arch_blank x86_64 -fat_stub_x86_64.depends += i386 ppc64 - -bad.commands = $$PWD/generate-bad.pl -bad.depends += $$PWD/generate-bad.pl - -MYTARGETS = $$fat_all.depends fat_all fat_no_x86_64 fat_no_i386 \ - fat_stub_i386 fat_stub_x86_64 bad -all.depends += $$MYTARGETS -QMAKE_EXTRA_TARGETS += i386_d x86_64_d $$MYTARGETS all - -QMAKE_CLEAN += $$i386.target $$x86_64.target $$ppc64.target $$fat_all.target \ - $$fat_no_i386.target $$fat_no_x86_64.target \ - $$fat_stub_i386.target $$fat_stub_x86_64.target \ - "bad*.dylib" +SUBDIRS = \ + machtest_i386.pro \ + machtest_x86_64.pro \ + machtest_ppc64.pro \ + machtest_fat.pro +machtest_fat-pro.depends = \ + machtest_i386.pro \ + machtest_x86_64.pro \ + machtest_ppc64.pro +machtest_ppc64-pro.depends = \ + machtest_x86_64.pro diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro new file mode 100644 index 0000000000..8daa343e2b --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro @@ -0,0 +1,41 @@ +TEMPLATE = aux +OTHER_FILES += generate-bad.pl + +# Needs explicit load()ing due to aux template. Relies on QT being non-empty. +load(qt) + +# Generate a fat binary with three architectures +fat_all.target = good.fat.all.dylib +fat_all.commands = lipo -create -output $@ \ + -arch ppc64 good.ppc64.dylib \ + -arch i386 good.i386.dylib \ + -arch x86_64 good.x86_64.dylib +fat_all.depends += good.i386.dylib good.x86_64.dylib good.ppc64.dylib + +fat_no_i386.target = good.fat.no-i386.dylib +fat_no_i386.commands = lipo -create -output $@ -arch x86_64 good.x86_64.dylib -arch ppc64 good.ppc64.dylib +fat_no_i386.depends += good.x86_64.dylib good.ppc64.dylib + +fat_no_x86_64.target = good.fat.no-x86_64.dylib +fat_no_x86_64.commands = lipo -create -output $@ -arch i386 good.i386.dylib -arch ppc64 good.ppc64.dylib +fat_no_x86_64.depends += good.i386.dylib good.ppc64.dylib + +fat_stub_i386.target = good.fat.stub-i386.dylib +fat_stub_i386.commands = lipo -create -output $@ -arch ppc64 good.ppc64.dylib -arch_blank i386 +fat_stub_i386.depends += good.x86_64.dylib good.ppc64.dylib + +fat_stub_x86_64.target = good.fat.stub-x86_64.dylib +fat_stub_x86_64.commands = lipo -create -output $@ -arch ppc64 good.ppc64.dylib -arch_blank x86_64 +fat_stub_x86_64.depends += good.i386.dylib good.ppc64.dylib + +bad.commands = $$PWD/generate-bad.pl +bad.depends += $$PWD/generate-bad.pl + +MYTARGETS = $$fat_all.depends fat_all fat_no_x86_64 fat_no_i386 \ + fat_stub_i386 fat_stub_x86_64 bad +all.depends += $$MYTARGETS +QMAKE_EXTRA_TARGETS += $$MYTARGETS all + +QMAKE_CLEAN += $$fat_all.target $$fat_no_i386.target $$fat_no_x86_64.target \ + $$fat_stub_i386.target $$fat_stub_x86_64.target \ + "bad*.dylib" diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro new file mode 100644 index 0000000000..bfb2e0930c --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro @@ -0,0 +1,3 @@ +QMAKE_APPLE_DEVICE_ARCHS = i386 +include(machtest.pri) + diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro new file mode 100644 index 0000000000..a73f97ccc6 --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro @@ -0,0 +1,9 @@ +QMAKE_APPLE_DEVICE_ARCHS = ppc64 +include(machtest.pri) + +OTHER_FILES += ppcconverter.pl + +# Current macOS toolchains have no compiler for PPC anymore +# So we fake it by converting an x86-64 binary to (little-endian!) PPC64 +goodlib.commands = $$PWD/ppcconverter.pl $< $@ +goodlib.depends = good.x86_64.dylib $$PWD/ppcconverter.pl diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro new file mode 100644 index 0000000000..9dbae5c4ee --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro @@ -0,0 +1,2 @@ +QMAKE_APPLE_DEVICE_ARCHS = x86_64 +include(machtest.pri) -- cgit v1.2.3