Patches for cross compiling

Volker Grabsch vog at notjusthosting.com
Sun Jun 4 16:13:23 UTC 2006


Dear Debain SDL maintainers,

I'm not subscribed to the list, please CC any replies to me.

I was trying to cross compile SDL for the win32 platform using
Debian's MinGW cross compiler (package mingw32).

It was a hard time to make my changes as non-invasive as possible,
as I don't want to clutter your work. So I decided to work with
dpkg-cross which allows me to 1) produce Debian binary packages as
if they were part of a Debian "w32-i386" platform, and 2) convert
those packages to cross compiling packages available for the "all"
platform.

The result of my work are two patches. Both don't break the native build.

* patch-cross-compiling-libsdl1.2-1.2.9-5.diff

    -- some bugfixes to make your package generally work with
       cross compilers and dpkg-cross:

    * Bugfix: use DEB_HOST_ARCH_OS instead of DEB_BUILD_ARCH_OS for
      building decisions

    * Bugfix: use "--disable-nasm" on builds for w32, as SDL's
      win_xp assembler code breaks with it

    * Bugfix: always create the "debian/libsdl1.2debian-$$sound/DEBIAN"
      directory before writing "shlibs" as these directories aren't
      created automatically when cross compiling. You already did that
      for the "udeb" packages, I just applied it to the other ones, too.


* patch-handling-dll-libsdl1.2-1.2.9-5.diff

    -- handle DLL files

    * include usr/bin/SDL.dll (if it exists) into libsdl1.2debian-all
      (this is done using the wildcard usr/bin/*.dll which won't break
       if no DLL file is produced)

    * strip the DLL file manually, as dh_strip isn't able to recognize
      DLL files


While the first patch is strictly necessary to make the SDL package
ready for win32 cross compiling, the second patch is "nice to have".
I hope you accept both patches and include them into your next upload
to Debian/Unstable. Thanks in advance.


Greets,

    Volker

-- 
Volker Grabsch
---<<(())>>---
Administrator
NotJustHosting GbR
-------------- next part --------------
diff -r bfebd8a89c20 -r 00239454efe3 libsdl1.2-1.2.9/debian/rules
--- a/libsdl1.2-1.2.9/debian/rules	Sat Jun 03 21:40:05 2006 +0200
+++ b/libsdl1.2-1.2.9/debian/rules	Sun Jun 04 16:57:41 2006 +0200
@@ -11,7 +11,7 @@ export SHLIBVER=(>> 1.2.7+1.2.8)
 
 DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_BUILD_ARCH_OS	?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
+DEB_HOST_ARCH_OS	?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 
 export DEB_HOST_GNU_TYPE
 export DEB_BUILD_GNU_TYPE
@@ -48,17 +48,21 @@ endif
 endif
 
 # Only build SVGA support on linux-x86
-ifeq ($(shell dpkg-architecture -qDEB_BUILD_ARCH),i386)
+ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),i386)
   all_confflags += --enable-video-svga
   LIBSVGA1-DEV = libsvga1-dev
 endif
 # Only use NASM routines on x86 CPUs
-ifeq ($(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU),i386)
+ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH_CPU),i386)
   confflags += --enable-nasm
+endif
+# Don't use NASM routines on win32
+ifeq ($(DEB_HOST_ARCH_OS),w32)
+  confflags += --disable-nasm
 endif
 
 # Only build ALSA support on Linux targets
-ifeq ($(DEB_BUILD_ARCH_OS),linux)
+ifeq ($(DEB_HOST_ARCH_OS),linux)
   SOUNDS += alsa
   LIBASOUND2-DEV = libasound2-dev
   no_libasound =
@@ -164,7 +168,10 @@ binary-arch: $(STAMP_DIR)/install
 	dh_compress
 	dh_fixperms
 	dh_makeshlibs
-	for sound in all $(SOUNDS); do echo "libSDL-1.2 0 libsdl1.2debian $$SHLIBVER" > debian/libsdl1.2debian-$$sound/DEBIAN/shlibs; done
+	for sound in all $(SOUNDS); do \
+	    mkdir -p debian/libsdl1.2debian-$$sound/DEBIAN; \
+	    echo "libSDL-1.2 0 libsdl1.2debian $$SHLIBVER" > debian/libsdl1.2debian-$$sound/DEBIAN/shlibs; \
+	done
 	mkdir -p debian/libsdl1.2debian-udeb/DEBIAN
 	echo "libSDL-1.2 0 libsdl1.2debian $$SHLIBVER" > debian/libsdl1.2debian-udeb/DEBIAN/shlibs
 	dh_installdeb
-------------- next part --------------
diff -r 00239454efe3 -r ed4d93e92af8 libsdl1.2-1.2.9/debian/libsdl1.2debian-all.install
--- a/libsdl1.2-1.2.9/debian/libsdl1.2debian-all.install	Sun Jun 04 16:57:41 2006 +0200
+++ b/libsdl1.2-1.2.9/debian/libsdl1.2debian-all.install	Sun Jun 04 17:47:07 2006 +0200
@@ -1,1 +1,2 @@ usr/lib/*.so.*
 usr/lib/*.so.*
+usr/bin/*.dll
diff -r 00239454efe3 -r ed4d93e92af8 libsdl1.2-1.2.9/debian/rules
--- a/libsdl1.2-1.2.9/debian/rules	Sun Jun 04 16:57:41 2006 +0200
+++ b/libsdl1.2-1.2.9/debian/rules	Sun Jun 04 17:47:07 2006 +0200
@@ -165,6 +165,7 @@ binary-arch: $(STAMP_DIR)/install
 	rm -rf debian/libsdl1.2debian/usr/include
 	rm -rf debian/libsdl1.2-dev/usr/share/doc/libsdl1.2-dev/docs/man3
 	dh_strip
+	-strip debian/*/usr/bin/*.dll
 	dh_compress
 	dh_fixperms
 	dh_makeshlibs


More information about the Pkg-sdl-maintainers mailing list