[3f9ab6]: mac / ExternalPrograms / scripts / libpng.sh  Maximize  Restore  History

Download this file

158 lines (123 with data), 3.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# ------------------
# libpng
# ------------------
# $Id: libpng.sh 1902 2007-02-04 22:27:47Z ippei $
# Copyright (c) 2007, Ippei Ukai
# prepare
# export REPOSITORYDIR="/PATH2HUGIN/mac/ExternalPrograms/repository" \
# ARCHS="ppc i386" \
# ppcTARGET="powerpc-apple-darwin8" \
# i386TARGET="i386-apple-darwin8" \
# ppcMACSDKDIR="/Developer/SDKs/MacOSX10.4u.sdk" \
# i386MACSDKDIR="/Developer/SDKs/MacOSX10.3.9.sdk" \
# ppcONLYARG="-mcpu=G3 -mtune=G4" \
# i386ONLYARG="-mfpmath=sse -msse2 -mtune=pentium-m -ftree-vectorize" \
# ppc64ONLYARG="-mcpu=G5 -mtune=G5 -ftree-vectorize" \
# OTHERARGs="";
PNGVER="1.2.29"
# init
let NUMARCH="0"
for i in $ARCHS
do
NUMARCH=$(($NUMARCH + 1))
done
mkdir -p "$REPOSITORYDIR/bin";
mkdir -p "$REPOSITORYDIR/lib";
mkdir -p "$REPOSITORYDIR/include";
# patch
# makefile.darwin
if [ `uname -r | grep 9.` ]
then # hack for leopard; libpng bug #2009836
sed -e 's/-dynamiclib/-dynamiclib \$\(GCCLDFLAGS\)/g' \
-e 's/_version \$(PNGVER)/_version 1.2.29/g' \
scripts/makefile.darwin > makefile;
else
sed -e 's/-dynamiclib/-dynamiclib \$\(GCCLDFLAGS\)/g' scripts/makefile.darwin > makefile;
fi
# pngconf.h
if [ -f pngconf-bk.h ]
then
mv -f pngconf-bk.h pngconf.h
fi
cp pngconf.h pngconf-bk.h
patch < $(dirname $0)/pngconf_h.patch
# compile
for ARCH in $ARCHS
do
mkdir -p "$REPOSITORYDIR/arch/$ARCH/bin";
mkdir -p "$REPOSITORYDIR/arch/$ARCH/lib";
mkdir -p "$REPOSITORYDIR/arch/$ARCH/include";
ARCHARGs=""
MACSDKDIR=""
if [ $ARCH = "i386" -o $ARCH = "i686" ]
then
TARGET=$i386TARGET
MACSDKDIR=$i386MACSDKDIR
ARCHARGs="$i386ONLYARG"
elif [ $ARCH = "ppc" -o $ARCH = "ppc750" -o $ARCH = "ppc7400" ]
then
TARGET=$ppcTARGET
MACSDKDIR=$ppcMACSDKDIR
ARCHARGs="$ppcONLYARG"
elif [ $ARCH = "ppc64" -o $ARCH = "ppc970" ]
then
TARGET=$ppc64TARGET
MACSDKDIR=$ppc64MACSDKDIR
ARCHARGs="$ppc64ONLYARG"
elif [ $ARCH = "x86_64" ]
then
TARGET=$x64TARGET
MACSDKDIR=$x64MACSDKDIR
ARCHARGs="$x64ONLYARG"
fi
make clean;
make $OTHERMAKEARGs install-static install-shared \
prefix="$REPOSITORYDIR" \
ZLIBLIB="$MACSDKDIR/usr/lib" \
ZLIBINC="$MACSDKDIR/usr/include" \
CFLAGS="-isysroot $MACSDKDIR -arch $ARCH $ARCHARGs $OTHERARGs -O2 -dead_strip" \
LDFLAGS="-L$REPOSITORYDIR/lib -L. -L$ZLIBLIB -lpng12 -lz" \
NEXT_ROOT="$MACSDKDIR" \
LIBPATH="$REPOSITORYDIR/arch/$ARCH/lib" \
BINPATH="$REPOSITORYDIR/arch/$ARCH/bin" \
GCCLDFLAGS="-isysroot $MACSDKDIR -arch $ARCH $ARCHARGs $OTHERARGs";
done
# merge libpng
for liba in lib/libpng12.a lib/libpng12.0.$PNGVER.dylib lib/libpng.3.$PNGVER.dylib
do
if [ $NUMARCH -eq 1 ]
then
mv "$REPOSITORYDIR/arch/$ARCHS/$liba" "$REPOSITORYDIR/$liba";
if [[ $liba == *.a ]]
then
ranlib "$REPOSITORYDIR/$liba";
fi
continue
fi
LIPOARGs=""
for ARCH in $ARCHS
do
LIPOARGs="$LIPOARGs $REPOSITORYDIR/arch/$ARCH/$liba"
done
lipo $LIPOARGs -create -output "$REPOSITORYDIR/$liba";
if [[ $liba == *.a ]]
then
ranlib "$REPOSITORYDIR/$liba";
fi
done
if [ -f "$REPOSITORYDIR/lib/libpng12.a" ]
then
ln -sfn libpng12.a $REPOSITORYDIR/lib/libpng.a;
fi
if [ -f "$REPOSITORYDIR/lib/libpng12.0.$PNGVER.dylib" ]
then
install_name_tool -id "$REPOSITORYDIR/lib/libpng12.0.dylib" "$REPOSITORYDIR/lib/libpng12.0.$PNGVER.dylib"
ln -sfn libpng12.0.$PNGVER.dylib $REPOSITORYDIR/lib/libpng12.0.dylib;
ln -sfn libpng12.0.$PNGVER.dylib $REPOSITORYDIR/lib/libpng12.dylib;
fi
if [ -f "$REPOSITORYDIR/lib/libpng.3.$PNGVER.dylib" ]
then
install_name_tool -id "$REPOSITORYDIR/lib/libpng.3.dylib" "$REPOSITORYDIR/lib/libpng.3.$PNGVER.dylib"
ln -sfn libpng.3.$PNGVER.dylib $REPOSITORYDIR/lib/libpng.3.dylib;
ln -sfn libpng.3.$PNGVER.dylib $REPOSITORYDIR/lib/libpng.dylib;
fi

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks