-
Notifications
You must be signed in to change notification settings - Fork 71
/
compile_im.sh
executable file
·104 lines (96 loc) · 3.85 KB
/
compile_im.sh
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
#!/bin/bash
im_compile() {
echo "[|- MAKE $BUILDINGFOR]"
try make -j$CORESNUM
try make install
echo "[|- CP STATIC/DYLIB $BUILDINGFOR]"
cp $LIBPATH_core $LIB_DIR/$LIBNAME_core.$BUILDINGFOR
cp $LIBPATH_wand $LIB_DIR/$LIBNAME_wand.$BUILDINGFOR
cp $LIBPATH_magickpp $LIB_DIR/$LIBNAME_magickpp.$BUILDINGFOR
if [[ "$BUILDINGFOR" == "armv7s" ]]; then # copy include and config files
# copy the wand/ + core/ headers
cp -r $IM_LIB_DIR/include/ImageMagick-*/magick/ $LIB_DIR/include/magick/
cp -r $IM_LIB_DIR/include/ImageMagick-*/wand/ $LIB_DIR/include/wand/
cp -r $IM_LIB_DIR/include/ImageMagick-*/magick++/ $LIB_DIR/include/magick++/
cp -r $IM_LIB_DIR/include/ImageMagick-*/Magick++.h $LIB_DIR/include/Magick++.h
# copy configuration files needed for certain functions
cp -r $IM_LIB_DIR/etc/ImageMagick-*/ $LIB_DIR/include/im_config/
cp -r $IM_LIB_DIR/share/ImageMagick-*/ $LIB_DIR/include/im_config/
fi
echo "[|- CLEAN $BUILDINGFOR]"
try make distclean
}
im () {
echo "[+ IM: $1]"
cd $IM_DIR
# static library that will be generated
LIBPATH_core=$IM_LIB_DIR/lib/libMagickCore-6.Q8.a
LIBNAME_core=`basename $LIBPATH_core`
LIBPATH_wand=$IM_LIB_DIR/lib/libMagickWand-6.Q8.a
LIBNAME_wand=`basename $LIBPATH_wand`
LIBPATH_magickpp=$IM_LIB_DIR/lib/libMagick++-6.Q8.a
LIBNAME_magickpp=`basename $LIBPATH_magickpp`
if [ "$1" == "armv7" ] || [ "$1" == "armv7s" ] || [ "$1" == "arm64" ]; then
save
armflags $1
export CC="$(xcode-select -print-path)/usr/bin/gcc" # override clang
export CPPFLAGS="-I$LIB_DIR/include/jpeg -I$LIB_DIR/include/png -I$LIB_DIR/include/tiff"
export CFLAGS="$CFLAGS -DTARGET_OS_IPHONE"
export LDFLAGS="$LDFLAGS -L$LIB_DIR/jpeg_${BUILDINGFOR}_dylib/ -L$LIB_DIR/png_${BUILDINGFOR}_dylib/ -L$LIB_DIR/tiff_${BUILDINGFOR}_dylib/ -L$LIB_DIR"
echo "[|- CONFIG $BUILDINGFOR]"
try ./configure prefix=$IM_LIB_DIR --host=arm-apple-darwin \
--disable-opencl --disable-largefile --with-quantum-depth=8 --with-magick-plus-plus \
--without-perl --without-x --disable-shared --disable-openmp --without-bzlib --without-freetype
im_compile
restore
elif [ "$1" == "i386" ] || [ "$1" == "x86_64" ]; then
save
intelflags $1
export CPPFLAGS="$CPPFLAGS -I$LIB_DIR/include/jpeg -I$LIB_DIR/include/png -I$LIB_DIR/include/tiff -I$SIMSDKROOT/usr/include"
export LDFLAGS="$LDFLAGS -L$LIB_DIR/jpeg_${BUILDINGFOR}_dylib/ -L$LIB_DIR/png_${BUILDINGFOR}_dylib/ -L$LIB_DIR/tiff_${BUILDINGFOR}_dylib/ -L$LIB_DIR"
echo "[|- CONFIG $BUILDINGFOR]"
try ./configure prefix=$IM_LIB_DIR --host=${BUILDINGFOR}-apple-darwin --disable-opencl \
--disable-largefile --with-quantum-depth=8 --with-magick-plus-plus --without-perl --without-x \
--disable-shared --disable-openmp --without-bzlib --without-freetype --without-threads --disable-dependency-tracking
im_compile
restore
else
echo "[ERR: Nothing to do for $1]"
fi
# join libMagickCore
joinlibs=$(check_for_archs $LIB_DIR/$LIBNAME_core)
if [ $joinlibs == "OK" ]; then
echo "[|- COMBINE $ARCHS]"
accumul=""
for i in $ARCHS; do
accumul="$accumul -arch $i $LIB_DIR/$LIBNAME_core.$i"
done
# combine the static libraries
try lipo $accumul -create -output $LIB_DIR/libMagickCore.a
echo "[+ DONE]"
fi
# join libMacigkWand
joinlibs=$(check_for_archs $LIB_DIR/$LIBNAME_wand)
if [ $joinlibs == "OK" ]; then
echo "[|- COMBINE $ARCHS]"
accumul=""
for i in $ARCHS; do
accumul="$accumul -arch $i $LIB_DIR/$LIBNAME_wand.$i"
done
# combine the static libraries
try lipo $accumul -create -output $LIB_DIR/libMagickWand.a
echo "[+ DONE]"
fi
# join libMagick++
joinlibs=$(check_for_archs $LIB_DIR/$LIBNAME_magickpp)
if [ $joinlibs == "OK" ]; then
echo "[|- COMBINE $ARCHS]"
accumul=""
for i in $ARCHS; do
accumul="$accumul -arch $i $LIB_DIR/$LIBNAME_magickpp.$i"
done
# combine the static libraries
try lipo $accumul -create -output $LIB_DIR/libMagick++.a
echo "[+ DONE]"
fi
}