[AD] Cross compiling 3.9.31

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Many moons ago I submitted some patches to assist compiling Allegro
with a Linux-hosted, djgpp-targetted cross-compiler (actually the host
can probably be any Unix, but Linux is the common case and the one I
use).

Shawn's applied these, but I got distracted before finishing the job.
Now I'm back for round 2...

OK, here's what needs to be done by hand to cross-compile Allegro.
Firstly unpack the sources:

 tar zxvf allegro-3.9.31.tar.gz
 cd allegro-3.9.31

Fix CRs in makefile and makefile.dj (might be easier to just `unzip
-a' the zipped sources, but I've not tried that approach):

 perl -p -i -e 's/\r//' makefile makefile.dj

Then you need to apply this patch (the first hunk disables generating
the documentation, the second hunk just corrects a typo in
makefile.dj, and the third fixes MMX detection - without the quotes
the command is just `echo' followed by a comment!):

--- allegro-3.9.31-orig/makefile.dj	Sun Jan 30 21:46:54 2000
+++ allegro-3.9.31/makefile.dj	Thu Feb 24 00:39:37 2000
@@ -21,8 +21,8 @@
 # -------- autodetect whether to use LFN --------
 
 ifdef CROSSCOMPILE
-HTML = html
-INFO = info
+#HTML = html
+#INFO = info
 TEXI = texi
 else
 ifeq ($(LFN),y)
@@ -48,7 +48,7 @@
 
 ifndef DJDIR
 baddjgpp:
-	@echo Your DJGPP environment variable is not set correctly! It should
+	@echo Your DJDIR environment variable is not set correctly! It should
 	@echo point to the djgpp.env file: see the djgpp readme.1st for details.
 endif

@@ -295,7 +295,7 @@
 	echo .text > obj/djgpp/mmxtest.s
 	echo emms >> obj/djgpp/mmxtest.s
 	gcc -c obj/djgpp/mmxtest.s -o obj/djgpp/mmxtest.o
-	echo #define ALLEGRO_MMX > obj/djgpp/mmx.h
+	echo '#define ALLEGRO_MMX' > obj/djgpp/mmx.h
 else
 	echo // no MMX > obj\djgpp\mmx.h
 	echo .text > obj\djgpp\mmxtest.s

 patch < allegro-cross.patch

Point at cross-djgpp installation (caution your installation may be
elsewhere, so check):

 export DJDIR=/usr/local/i386-pc-msdosdjgpp

Fiddle path so that "gcc" finds the djgpp cross-compiler, tell
makefile.dj we're crosscompiling and build stuff:

 PATH=$DJDIR/bin:$PATH CROSSCOMPILE=1 make

This will halt when it can't run asmdef.exe.  So we update timestamp
on pregenerated asmdef.inc shipped with the sources and then remake:

 touch obj/djgpp/asmdef.inc
 PATH=$DJDIR/bin:$PATH CROSSCOMPILE=1 make

Another halt, this time we trick make into thinking that setup.exe is
built as we can't generate setupdat.s when cross-compiling:

 touch obj/djgpp/setupdat.s obj/djgpp/setupdat.o setup/setup.exe

OK, now install (`rm -rf ...' is to remove any existing allegro header
directory):

 su
 [enter root password]
 cp -f lib/djgpp/liballeg.a $DJDIR/lib
 cp -f include/allegro.h $DJDIR/include
 rm -rf $DJDIR/include/allegro
 cp -r include/allegro $DJDIR/include/allegro

Phew!  Now this probably wants melding into makefile.dj, but at least
it's now written down somewhere public before I forget it.  Also it
would be desirable to build the documentation (the test and example
programs are of dubious value in a cross environment, but the docs are
still useful).  I'll try and sort this all out in the next week or so.

Cheers,
Olly
-- 
Two roads diverged in a wood, and I - I fought my way through the undergrowth.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/