[gtk/wip/lantw/build-Move-gtk.def-to-builddir] build: Move gtk.def to builddir




commit f203b1a751accbc55526d2e49cddc90355718a4a
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Wed Aug 26 01:01:56 2020 +0800

    build: Move gtk.def to builddir
    
    GTK2 uses different gtk.def files on 32-bit and 64-bit Windows. GTK2
    source tarballs ship pre-generated gtk.def for 32-bit Windows. If the
    user wants to build for 64-bit Windows, the pre-generated gtk.def must
    be deleted before the build to force regeneration, or it will fail to
    link with 'symbol not defined' errors because the 32-bit Windows build
    includes more legacy functions than the 64-bit Windows build.
    
    While users who want to build for 64-bit Windows can delete gtk.def in
    the build script, which is currently what most build scripts do, doing
    so breaks out-of-source build. On AUR, MinGW packages are usually built
    and packaged in the following order:
    
    1. Run 'configure' and 'make' to build for i686-w64-mingw32.
    2. Run 'configure' and 'make' to build for x86_64-w64-mingw32.
    3. Run 'make install' for i686-w64-mingw32.
    4. Run 'make install' for x86_64-w64-mingw32.
    
    It fails because step 3 sees gtk.def left by step 2, which is generated
    for a different build. In step 3, make sees the gtk.def change and runs
    libtool to relink libgtk-win32-2.0-0.dll. libtool fails to find a lot of
    necessary libraries, decides that it is not possible to build a DLL with
    -no-undefined, and produces only the static library. It then tries to
    relink executables with the static library, and fails with undefined
    reference to 'IID_IUnknown' because -Wl,--start-group isn't used and
    the use of -Wl,-luuid prevents libtool from using the correct order.
    
    To resolve the problem, move gtk.def to builddir so different builds can
    have different gtk.def files while sharing the same source tree. This
    also means that the source tarball will no longer include pre-generated
    gtk.def file, which should be acceptable because it is already broken on
    64-bit Windows.
    
    Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3029

 gtk/Makefile.am | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index cdbbd8c8d9..5b337da644 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -71,7 +71,7 @@ endif
 
 if OS_WIN32
 gtk_def = gtk.def
-gtk_win32_symbols = -export-symbols $(srcdir)/gtk.def
+gtk_win32_symbols = -export-symbols gtk.def
 
 gtk_win32_res = gtk-win32-res.o
 gtk_win32_res_ldflag = -Wl,gtk-win32-res.o
@@ -81,7 +81,7 @@ gtk-win32-res.o : gtk-win32.rc
 
 install-def-file: gtk.def
        $(mkinstalldirs) $(DESTDIR)$(libdir)
-       $(INSTALL) $(srcdir)/gtk.def $(DESTDIR)$(libdir)/gtk-win32-2.0.def
+       $(INSTALL) gtk.def $(DESTDIR)$(libdir)/gtk-win32-2.0.def
 uninstall-def-file:
        -rm $(DESTDIR)$(libdir)/gtk-win32-2.0.def
 else
@@ -106,10 +106,10 @@ install-ms-lib:
 uninstall-ms-lib:
 endif
 
-# This places the generated .def file in srcdir, since it is expected to be there.
-# (The one from a tarball is)
+# gtk.def has to be put in builddir and should not be included in a source
+# tarball because it differs in 32-bit and 64-bit Windows builds.
 gtk.def: gtk.symbols
-       (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gtk.symbols | 
sed -e '/^$$/d' -e 's/^/    /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gtk.def
+       (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gtk.symbols | 
sed -e '/^$$/d' -e 's/^/    /' -e 's/G_GNUC_[^ ]*//g') > gtk.def
 
 gtkalias.h: gtk.symbols
          $(PERL) $(srcdir)/makegtkalias.pl < $(srcdir)/gtk.symbols > gtkalias.h
@@ -836,7 +836,7 @@ EXTRA_DIST += $(STOCK_ICONS)
 #
 # setup autogeneration dependencies
 gen_sources = xgen-gdef xgen-gtbh xgen-gtic xgen-gmh xgen-gmc xgen-gmlh xgen-gmlc xgen-gtfsrc.c xgen-gtf
-CLEANFILES = $(gen_sources)
+CLEANFILES = $(gen_sources) $(gtk_def)
 
 BUILT_SOURCES = $(gtk_built_sources)
 
@@ -1463,7 +1463,6 @@ EXTRA_DIST +=                   \
        tree_minus.xbm          \
        tree_minus.xpm          \
        tree_plus.xpm           \
-       gtk.def                 \
        gtk-builder-convert     \
        gtk-win32.rc            \
        gtk-win32.rc.in         \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]