3 ###############################################################################
4 # Author: Anders F Björklund <afb@users.sourceforge.net>
6 # This file has been put into the public domain.
7 # You can do whatever you want with this file.
8 ###############################################################################
13 # Abort immediately if something goes wrong.
16 # Clean up if it was already configured.
17 [ -f Makefile
] && make distclean
19 # Build the regular fat program
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
29 make DESTDIR
=`pwd`/Root
install
33 # Build the size-optimized program
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
41 make -C src
/xzdec DESTDIR
=`pwd`/Root
install
43 cp -a ..
/extra Root
/usr
/local
/share
/doc
/xz
47 # Strip debugging symbols and make relocatable
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
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
59 strip
-S Root
/usr
/local
/lib
/liblzma.a
60 rm -f Root
/usr
/local
/lib
/liblzma.la
62 # Include pkg-config while making relocatable
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
67 # Create tarball, but without the HFS+ attrib
69 rmdir debug lib po src
/liblzma
/api src
/liblzma src
/lzmainfo src
/scripts src
/xz src
/xzdec src tests
71 ( cd Root
/usr
/local; COPY_EXTENDED_ATTRIBUTES_DISABLE
=true COPYFILE_DISABLE
=true
tar cvjf ..
/..
/..
/XZ.tbz
* )
73 # Include documentation files for package
75 cp -p ..
/README Resources
/ReadMe.txt
76 cp -p ..
/COPYING Resources
/License.txt
78 # Make an Installer.app package
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
85 # Put the package in a disk image
87 hdiutil create
-fs HFS
+ -format UDZO
-quiet -srcfolder XZ.pkg
-ov XZ.dmg
88 hdiutil internet-enable
-yes -quiet XZ.dmg
91 echo "Build completed successfully."