1
0
Fork 0
forked from len0rd/rockbox

Get beastpatcher working on OSX.

I don't know why we need to split the compiling and linking steps on OSX, but this was the only way
I could get static linking against libusb and libmtp to work.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23418 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Barry Wardell 2009-10-30 13:31:04 +00:00
parent a521c5fc67
commit 304fcbe633
2 changed files with 29 additions and 8 deletions

View file

@ -32,6 +32,7 @@ all: $(OUTPUT)
SOURCES = beastpatcher.c bootimg.c mknkboot.c main.c SOURCES = beastpatcher.c bootimg.c mknkboot.c main.c
HEADERS = beastpatcher.h mtp_common.h bootimg.h mknkboot.h HEADERS = beastpatcher.h mtp_common.h bootimg.h mknkboot.h
OBJS = beastpatcher.o bootimg.o mknkboot.o main.o mtp_libmtp.o
MTPSRCS_W32 = mtp_win32.c MTPSRCS_W32 = mtp_win32.c
MTPSRCS_MTP = mtp_libmtp.c MTPSRCS_MTP = mtp_libmtp.c
@ -46,12 +47,14 @@ beastpatcher.exe: $(SOURCES) $(HEADERS) $(MTPSRCS_W32) $(WINLIBS)
beastpatcher-mac: beastpatcher-i386 beastpatcher-ppc beastpatcher-mac: beastpatcher-i386 beastpatcher-ppc
lipo -create beastpatcher-ppc beastpatcher-i386 -output beastpatcher-mac lipo -create beastpatcher-ppc beastpatcher-i386 -output beastpatcher-mac
beastpatcher-i386: beastpatcher.c bootimg.c usb.h main.c libusb-i386.a beastpatcher-i386: $(SOURCES) $(HEADERS) $(MTPSRCS_MTP) usb.h libmtp.h libusb-i386.a libmtp-i386.a
$(CC) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -framework iokit -framework coreservices -arch i386 $(CFLAGS) -o beastpatcher-i386 beastpatcher.c bootimg.c -I. libusb-i386.a gcc -c -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 $(CFLAGS) -I. -DBEASTPATCHER $(SOURCES) $(MTPSRCS_MTP)
gcc -framework iokit -framework coreservices -arch i386 -o beastpatcher-i386 $(OBJS) libusb-i386.a libmtp-i386.a -liconv
strip beastpatcher-i386 strip beastpatcher-i386
beastpatcher-ppc: beastpatcher.c bootimg.c usb.h main.c libusb-ppc.a beastpatcher-ppc: $(SOURCES) $(HEADERS) $(MTPSRCS_MTP) usb.h libmtp.h libusb-ppc.a libmtp-ppc.a
$(CC) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -framework iokit -framework coreservices -arch ppc $(CFLAGS) -o beastpatcher-ppc beastpatcher.c bootimg.c -I. libusb-ppc.a gcc -c -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc $(CFLAGS) -I. -DBEASTPATCHER $(SOURCES) $(MTPSRCS_MTP)
gcc -framework iokit -framework coreservices -arch ppc -o beastpatcher-ppc $(OBJS) libusb-ppc.a libmtp-ppc.a -liconv
strip beastpatcher-ppc strip beastpatcher-ppc
bin2c: ../../../rbutil/tools/bin2c.c bin2c: ../../../rbutil/tools/bin2c.c
@ -63,4 +66,4 @@ bootimg.c: bootloader.bin bin2c
mknkboot: mknkboot.c mknkboot: mknkboot.c
$(SILENT)$(NATIVECC) $(CFLAGS) $+ -o $@ $(SILENT)$(NATIVECC) $(CFLAGS) $+ -o $@
clean: clean:
rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h mknkboot *~ rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h mknkboot *~ *.o

View file

@ -41,10 +41,28 @@ After this, just type "make" to get a
OS X OS X
---- ----
[Not yet implemented] The OS X build is a universal binary statically linked with libusb and libmtp.
It has been tested with libusb version 0.1.12 and libmtp version 1.0.1.
The OS X build is a universal binary statically linked with libusb and libmtp. The following files are expected the beaspatcher source directory:
Intel:
libusb: usb.h libusb-i386.a
libmtp: libmtp.h libmtp-i386.a
PowerPC:
libusb: usb.h libusb-ppc.a
libmtp: libmtp.h libmtp-ppc.a
These are easily compiled from source using the standard
'./configure && make'. Look in .libs for libusb.a and src/.libs for libmtp.a,
and make sure to rename them to their -i386/-ppc filenames when copying into
the beastpatcher directory.
After this, just type "make beastpatcher-mac" to get a universal binary. If you
only want a binary for a particular architecture, you can use
"make beastpatcher-i386" or "make beastpatcher-ppc" instead. In this case, you
only need the libusb and libmtp library for your desired architecture.
Windows Windows