Mac OS X: Replaced liblwjgl-legacy.jnilib and liblwjgl.jnilib with one liblwjgl.jnilib containing gcc 3 compiled ppc code in the ppc part and gcc 4 compiled intel code in the intel part. That way, we should be able to support all platforms and architectures with one library. I've replaced the Makefile.* files with a single build.xml to do the native building and merging of object code.

This commit is contained in:
Elias Naur 2006-05-01 12:07:58 +00:00
parent 3ce92a9563
commit 0f5489a883
4 changed files with 80 additions and 59 deletions

View file

@ -1,30 +0,0 @@
# This makefile builds a 'fat' library that is _only_ compatible with 10.4 and later
CC=gcc-4.0
LINKER=gcc-4.0
STRIP=strip
SDK_ROOT=/Developer/SDKs/MacOSX10.4u.sdk
ARCHS=-arch i386 -arch ppc
CFLAGS_LINK=-isysroot $(SDK_ROOT) $(ARCHS) -exported_symbols_list lwjgl.symbols -dynamiclib -Wall
SYMBOL_FILE=lwjgl.symbols
FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM -framework Carbon
CFLAGS_O=-isysroot $(SDK_ROOT) $(ARCHS) -fPIC -O2 -D_MACOSX -Wall -c -I$(SDK_ROOT)/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -I../common -I$(SDK_ROOT)/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
SRC=$(wildcard *.m) $(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../generated/*.c)
OBJECTS=$(subst .m,.o, $(subst .c,.o,$(SRC)))
LIBRARY=liblwjgl.jnilib
$(LIBRARY): $(OBJECTS) $(SYMBOL_FILE)
$(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(FRAMEWORKS)
$(STRIP) -S -X $@
$(SYMBOL_FILE): $(OBJECTS)
nm -g $(OBJECTS) | grep "Java_" | cut -d ' ' -f3 | cut -c 1- > $(SYMBOL_FILE)
.m.o:
$(CC) $(CFLAGS_O) $< -o $@
.c.o:
$(CC) $(CFLAGS_O) $< -o $@
clean:
rm -f $(OBJECTS) $(LIBRARY)

View file

@ -1,29 +0,0 @@
# Use this makefile to build for Mac OS X 10.3 and earlier
CC=gcc-3.3
LINKER=gcc-3.3
STRIP=strip
ARCHS=
SYMBOL_FILE=lwjgl.symbols
CFLAGS_LINK=-exported_symbols_list lwjgl.symbols -dynamiclib -Wall
FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM -framework Carbon
CFLAGS_O=-fPIC -O2 -D_MACOSX -Wall -c -I${AL}/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
SRC=$(wildcard *.m) $(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../generated/*.c)
OBJECTS=$(subst .m,.o, $(subst .c,.o,$(SRC)))
LIBRARY=liblwjgl-legacy.jnilib
$(LIBRARY): $(OBJECTS) $(SYMBOL_FILE)
$(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(FRAMEWORKS)
$(STRIP) -S -X $@
$(SYMBOL_FILE): $(OBJECTS)
nm -g $(OBJECTS) | grep "Java_" | cut -d ' ' -f3 | cut -c 1- > $(SYMBOL_FILE)
.m.o:
$(CC) $(CFLAGS_O) $< -o $@
.c.o:
$(CC) $(CFLAGS_O) $< -o $@
clean:
rm -f $(OBJECTS) $(LIBRARY)

View file

@ -0,0 +1,3 @@
#!/bin/sh
nm -g intel/*.o | grep "Java_" | cut -d ' ' -f3 | cut -c 1-

View file

@ -0,0 +1,77 @@
<?xml version="1.0" ?>
<project name="OS X Native code" basedir="." default="nativelibrary">
<target name="init">
<mkdir dir="ppc"/>
<mkdir dir="intel"/>
</target>
<target name="clean">
<delete failonerror="false">
<fileset dir="intel"/>
<fileset dir="ppc"/>
<fileset dir="." includes="liblwjgl.jnilib"/>
</delete>
</target>
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -O2 -Wall -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I../../common -I.."/>
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="." includes="*.m"/>
<fileset dir="." includes="*.c"/>
<fileset dir="../common" includes="*.c"/>
<fileset dir="../generated" includes="*.c"/>
</apply>
</target>
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true">
<arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
<arg line="-S -X"/>
<fileset dir="." file="${libname}"/>
</apply>
</target>
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
<property name="legacy_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot} -arch i386"/>
<antcall target="compile">
<param name="dstdir" location="intel"/>
<param name="compiler" value="gcc-4.0"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${universal_flags}"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="ppc"/>
<param name="compiler" value="gcc-3.3"/>
<param name="sdkroot" location="${legacy_sdkroot}"/>
<param name="cflags" value=""/>
</antcall>
<exec executable="./build-symbol-list" output="lwjgl.symbols"/>
<antcall target="link">
<param name="objdir" location="intel"/>
<param name="libname" value="liblwjgl-intel.jnilib"/>
<param name="linker" value="gcc-4.0"/>
<param name="linkerflags" value="${universal_flags}"/>
</antcall>
<antcall target="link">
<param name="objdir" location="ppc"/>
<param name="libname" value="liblwjgl-ppc.jnilib"/>
<param name="linker" value="gcc-3.3"/>
<param name="linkerflags" value=""/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" >
<arg value="-create"/>
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl.jnilib"/>
<mapper type="merge" to="liblwjgl.jnilib"/>
<fileset file="ppc/liblwjgl-ppc.jnilib"/>
<fileset file="intel/liblwjgl-intel.jnilib"/>
</apply>
</target>
</project>