Source: libsdl-sge Version: 030809dfsg-8 Tags: patch User: [email protected] Usertags: rebootstrap
libsdl-sge fails to cross build from source for multiple distinct reasons. * debian/rules does not pass any cross tools to make. Using dh_auto_build fixes that. * The (modified) upstream Makefile hard codes the build architecture pkg-config. * The upstream Makefile dependencies are messed up. For instance, the config target does not actually create the file "config". Thus it is rebuilt every time. This causes a rebuild in dh_auto_install for which debhelper does not pass cross tools. The attached patch fixes all of that and makes libsdl-sge cross buildable. Please consider applying it. Helmut
diff --minimal -Nru libsdl-sge-030809dfsg/debian/changelog libsdl-sge-030809dfsg/debian/changelog --- libsdl-sge-030809dfsg/debian/changelog 2018-10-19 22:26:15.000000000 +0200 +++ libsdl-sge-030809dfsg/debian/changelog 2018-10-28 14:40:16.000000000 +0100 @@ -1,3 +1,14 @@ +libsdl-sge (030809dfsg-8.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + Let dh_auto_build pass cross tools to make. + + cross.patch: Make pkg-config substitutable. + + cross.patch: Fix makefile dependencies to avoid excessive + rebuilds during make install. + + -- Helmut Grohne <[email protected]> Sun, 28 Oct 2018 14:40:16 +0100 + libsdl-sge (030809dfsg-8) unstable; urgency=medium * Bump Policy Standars-Version to 4.2.1 (no changes needed) diff --minimal -Nru libsdl-sge-030809dfsg/debian/patches/cross.patch libsdl-sge-030809dfsg/debian/patches/cross.patch --- libsdl-sge-030809dfsg/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ libsdl-sge-030809dfsg/debian/patches/cross.patch 2018-10-28 14:40:16.000000000 +0100 @@ -0,0 +1,66 @@ +--- libsdl-sge-030809dfsg.orig/Makefile.conf ++++ libsdl-sge-030809dfsg/Makefile.conf +@@ -11,6 +11,7 @@ + # Compilers (C and C++) + CC=gcc + CXX=g++ ++PKG_CONFIG?=pkg-config + + # Make sure sdl-config is available + HAVE_SDL =$(shell if (sdl-config --version) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) +@@ -36,15 +37,15 @@ + + + # Is freetype-config available? +-HAVE_FT =$(shell if (pkg-config --modversion freetype2) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) ++HAVE_FT =$(shell if ($(PKG_CONFIG) --modversion freetype2) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) + ifeq ($(HAVE_FT),n) + USE_FT = n + endif + + ifneq ($(USE_FT),n) + USE_FT = y +- SGE_LIBS +=$(shell pkg-config freetype2 --libs) +- FT_CFLAGS =$(shell pkg-config freetype2 --cflags) ++ SGE_LIBS +=$(shell $(PKG_CONFIG) freetype2 --libs) ++ FT_CFLAGS =$(shell $(PKG_CONFIG) freetype2 --cflags) + endif + + +--- libsdl-sge-030809dfsg.orig/Makefile ++++ libsdl-sge-030809dfsg/Makefile +@@ -11,20 +11,21 @@ + + OBJECTS=sge_surface.o sge_primitives.o sge_tt_text.o sge_bm_text.o sge_misc.o sge_textpp.o sge_blib.o sge_rotation.o sge_collision.o sge_shape.o + +-all: config $(OBJECTS) ++all: sge_config.h $(OBJECTS) + ar rsc libSGE.a $(OBJECTS) + + $(OBJECTS): %.o:%.cpp %.h #Each object depends on thier .cpp and .h file + $(CXX) $(CFLAGS) -c $< + +-shared: all ++shared: libSGE.so ++libSGE.so: sge_config.h $(OBJECTS) + $(CXX) $(CFLAGS) $(LDFLAGS) -Wl,-soname,libSGE.so.$(API_VER) -fpic -fPIC -shared -o libSGE.so $(OBJECTS) $(LIBS) + + shared-strip: shared + @strip libSGE.so + + # Building a dll... I have no idea how to do this, but it should be something like below. +-dll: config $(OBJECTS) ++dll: sge_config.h $(OBJECTS) + dlltool --output-def SGE.def $(OBJECTS) + dllwrap --driver-name $(CXX) -o SGE.dll --def SGE.def --output-lib libSGE.a --dllname SGE.dll $(OBJECTS) $(LIBS) + +@@ -34,7 +35,8 @@ + clean: + rm -f *.o *.so *.so.* *.a *.dll *.def + +-config: ++config:sge_config.h ++sge_config.h: + @echo "/* SGE Config header (generated automatically) */" >sge_config.h + @echo "#define SGE_VER $(SGE_VER)" >>sge_config.h + ifeq ($(C_COMP),y) diff --minimal -Nru libsdl-sge-030809dfsg/debian/patches/series libsdl-sge-030809dfsg/debian/patches/series --- libsdl-sge-030809dfsg/debian/patches/series 2018-10-19 22:17:58.000000000 +0200 +++ libsdl-sge-030809dfsg/debian/patches/series 2018-10-28 14:40:16.000000000 +0100 @@ -6,3 +6,4 @@ 010_examples.diff 015_overflow.diff 100_font.diff +cross.patch diff --minimal -Nru libsdl-sge-030809dfsg/debian/rules libsdl-sge-030809dfsg/debian/rules --- libsdl-sge-030809dfsg/debian/rules 2017-06-19 23:36:29.000000000 +0200 +++ libsdl-sge-030809dfsg/debian/rules 2018-10-28 14:40:15.000000000 +0100 @@ -21,13 +21,13 @@ override_dh_auto_build: # Build the static library and make a backup rm -f libSGE.a - $(MAKE) all CUSTOM_CFLAGS="$(ALL_CUSTOM_CFLAGS)" CUSTOM_LDFLAGS="$(ALL_CUSTOM_LDFLAGS)" + dh_auto_build -- all CUSTOM_CFLAGS="$(ALL_CUSTOM_CFLAGS)" CUSTOM_LDFLAGS="$(ALL_CUSTOM_LDFLAGS)" rm -f libSGE.bak mv libSGE.a libSGE.bak # Build the shared library and restore the static backup $(MAKE) clean - $(MAKE) shared CUSTOM_CFLAGS="$(ALL_CUSTOM_CFLAGS)" CUSTOM_LDFLAGS="$(ALL_CUSTOM_LDFLAGS)" + dh_auto_build -- shared CUSTOM_CFLAGS="$(ALL_CUSTOM_CFLAGS)" CUSTOM_LDFLAGS="$(ALL_CUSTOM_LDFLAGS)" rm -f libSGE.a mv libSGE.bak libSGE.a

