]> icculus.org git repositories - icculus/xz.git/blob - macosx/build.sh
Removed what I believe is an incorrect #ifdef HAVE_* test.
[icculus/xz.git] / macosx / build.sh
1 #!/bin/sh
2
3 ###############################################################################
4 # Author: Anders F Björklund <afb@users.sourceforge.net>
5 #
6 # This file has been put into the public domain.
7 # You can do whatever you want with this file.
8 ###############################################################################
9
10 mkdir -p Root
11 mkdir -p Resources
12
13 # Abort immediately if something goes wrong.
14 set -e
15
16 # Clean up if it was already configured.
17 [ -f Makefile ] && make distclean
18
19 # Build the regular fat program
20
21 CC="gcc-4.0" \
22 CFLAGS="-O2 -g -arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
23 ../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec i686-apple-darwin8
24
25 make
26
27 make check
28
29 make DESTDIR=`pwd`/Root install
30
31 make distclean
32
33 # Build the size-optimized program
34
35 CC="gcc-4.0" \
36 CFLAGS="-Os -g -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
37 ../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads i686-apple-darwin8
38
39 make -C src/liblzma
40 make -C src/xzdec
41 make -C src/xzdec DESTDIR=`pwd`/Root install
42
43 cp -a ../extra Root/usr/local/share/doc/xz
44
45 make distclean
46
47 # Strip debugging symbols and make relocatable
48
49 for bin in xz lzmainfo xzdec lzmadec; do
50     strip -S Root/usr/local/bin/$bin
51     install_name_tool -change /usr/local/lib/liblzma.5.dylib @executable_path/../lib/liblzma.5.dylib Root/usr/local/bin/$bin
52 done
53
54 for lib in liblzma.5.dylib; do
55     strip -S Root/usr/local/lib/$lib
56     install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
57 done
58
59 strip -S  Root/usr/local/lib/liblzma.a
60 rm -f Root/usr/local/lib/liblzma.la
61
62 # Include pkg-config while making relocatable
63
64 sed -e 's|prefix=/usr/local|prefix=${pcfiledir}/../..|' < Root/usr/local/lib/pkgconfig/liblzma.pc > Root/liblzma.pc
65 mv Root/liblzma.pc Root/usr/local/lib/pkgconfig/liblzma.pc
66
67 # Create tarball, but without the HFS+ attrib
68
69 rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
70
71 ( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
72
73 # Include documentation files for package
74
75 cp -p ../README Resources/ReadMe.txt
76 cp -p ../COPYING Resources/License.txt
77
78 # Make an Installer.app package
79
80 ID="org.tukaani.xz"
81 VERSION=`cd ..; sh build-aux/version.sh`
82 PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
83 $PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g 10.4 --verbose
84
85 # Put the package in a disk image
86
87 hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
88 hdiutil internet-enable -yes -quiet XZ.dmg
89
90 echo
91 echo "Build completed successfully."
92 echo