Cleaned lipo builder up a bit.
[puredarwin_setup.git] / buildLipo.sh
blob65cc048cebb9d968f2e59f9d7fa31a97bfe36dae
1 #!/usr/bin/env bash
2 # $1 ... install prefix -- defaults to /usr/local
4 PREFIX="${1:-/usr/local}"
5 USETAR=no
7 # tarball is kinda out of date and not compiling
8 #BASEURL="http://svn.macosforge.org/repository/odcctools/release"
9 #ODCCTOOLS=odcctools-20090808.tar.bz2
10 #ODCCTOOLS_MD5SUM=cb8ce536e204fc2399fc27079012c37b
13 # svn version
14 BASEURL="http://svn.macosforge.org/repository/odcctools/trunk/"
15 ODCCTOOLS=odcctools
17 function die() {
18 echo "ERROR: ${1}"
19 exit 1
22 # tarball fetch
23 if [[ ${USETAR} != no ]]; then
24 if [[ -e ${ODCCTOOLS} ]]; then
25 MD5LINE="${ODCCTOOLS_MD5SUM} ${ODCCTOOLS}"
26 if ! echo "${MD5LINE}" | md5sum -c --quiet -; then
27 echo "Re-fetching ${ODCCTOOLS} due to checksum error"
28 rm -f ${ODCCTOOLS}
29 else
30 echo "Using pre-downloaded ${ODCCTOOLS}"
31 NOFETCH=yes
35 if [[ ${NOFETCH} != yes ]]; then
36 wget "${BASEURL}/${ODCCTOOLS}"
39 tar jxf ${ODCCTOOLS} || die "Unpacking ${ODCCTOOLS} failed"
40 S=${ODCCTOOLS/.tar.bz2}
41 # subversion fetch
42 else
43 if [[ -e ${ODCCTOOLS} ]]; then
44 pushd ${ODCCTOOLS}
45 svn up
46 popd
47 else
48 svn co "${BASEURL}" ${ODCCTOOLS}
51 pushd ${ODCCTOOLS}
52 ./extract.sh || die "Unpacking with ./extract.sh failed"
53 popd
54 S=${ODCCTOOLS}/odcctools
60 # compilation
61 pushd ${S} || die "pushd failed"
62 ./configure --target=i386-apple-darwin9 --prefix="${PREFIX}" || die "configure failed"
63 make -C libstuff || die "make libstuff failed"
64 make -C misc lipo || die "make lipo failed"
65 mkdir -p "${PREFIX}"/bin || die "mkdir install dir failed"
66 cp misc/lipo "${PREFIX}"/bin/ || die "copying lipo failed"
67 popd || die "popd failed"