after embedded library cleanup
[TestXSLT.git] / libs / compile_libs.sh
1 #!/bin/sh
2
3 echo executing $0
4 echo ACTION is $ACTION
5
6
7 LIBS_TAR_DIR="`pwd`/libs"
8 LIBS_DEST_DIR="$BUILD_DIR/libs"
9 LIBS_INST_DIR="$LIBS_DEST_DIR/inst"
10 LIBS_SRC_DIR="$LIBS_DEST_DIR/src"
11
12 TAR_LIBXML2="$LIBS_TAR_DIR/libxml2-2.6.17.tar.gz"
13 TAR_LIBXSLT="$LIBS_TAR_DIR/libxslt-1.1.12.tar.gz"
14 TAR_EXPAT="$LIBS_TAR_DIR/expat-2005-01-28.tar.gz"
15 TAR_SABLOT="$LIBS_TAR_DIR/Sablot-1.0.2.tar.gz"
16
17 echo $LIBS_TAR_DIR / $LIBS_DEST_DIR / $LIBS_INST_DIR / $LIBS_BUILD_DIR
18
19 [ -e "$LIBS_TAR_DIR" ]  || exit 1
20 [ -e "$LIBS_DEST_DIR" ] || mkdir -p "$LIBS_DEST_DIR"  || exit 1
21 [ -e "$LIBS_INST_DIR" ] || mkdir -p "$LIBS_INST_DIR"  || exit 1
22 [ -e "$LIBS_SRC_DIR" ]  || mkdir -p "$LIBS_SRC_DIR"   || exit 1
23
24
25
26
27 #### setup libxml2
28 LIB="$LIBS_DEST_DIR/libxml2.dylib"
29 if [ ! -e "$LIB" ]; then
30
31         echo building "$LIB"
32
33         cd "$LIBS_SRC_DIR"
34         tar -xzf "$TAR_LIBXML2"
35         cd libxml2-*
36         ./configure --prefix="$LIBS_INST_DIR"
37         make install
38
39         cp "$LIBS_INST_DIR/lib/libxml2.dylib" "$LIB"
40         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
41
42 fi
43
44
45 #### setup libxslt
46 LIB="$LIBS_DEST_DIR/libxslt.dylib"
47 if [ ! -e "$LIB" ]; then
48
49         echo building "$LIB"
50
51         cd "$LIBS_SRC_DIR"
52         tar -xzf "$TAR_LIBXSLT"
53         cd libxslt-*
54         ./configure --prefix="$LIBS_INST_DIR" --with-libxml-prefix="$LIBS_INST_DIR"
55         make install
56
57         cp "$LIBS_INST_DIR/lib/libxslt.dylib" "$LIB"
58         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
59
60         cp "$LIBS_INST_DIR/lib/libexslt.dylib" "$LIBS_DEST_DIR/libexslt.dylib"
61         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIBS_DEST_DIR/libexslt.dylib" "$BUILD_DIR"
62
63 fi
64
65
66 #### setup libexpat
67 LIB="$LIBS_DEST_DIR/libexpat.dylib"
68 if [ ! -e "$LIB" ]; then
69
70         echo building "$LIB"
71
72         cd "$LIBS_SRC_DIR"
73         tar -xzf "$TAR_EXPAT"
74         cd expat-*
75         ./configure --prefix="$LIBS_INST_DIR"
76         INSTALL_ROOT="/" make -e install
77
78         cp "$LIBS_INST_DIR/lib/libexpat.dylib" "$LIB"
79         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
80
81 fi
82
83
84 #### setup libSablot
85 LIB="$LIBS_DEST_DIR/libSablot.dylib"
86 if [ ! -e "$LIB" ]; then
87
88         echo building "$LIB"
89
90         cd "$LIBS_SRC_DIR"
91         tar -xzf "$TAR_SABLOT"
92         cd Sablot-*
93
94         ./configure --disable-adding-meta --with-expat="$LIBS_INST_DIR" --prefix="$LIBS_INST_DIR"
95         make install
96
97         cp "$LIBS_INST_DIR/lib/libSablot.dylib" "$LIB"
98         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
99
100 fi
101
102
103 exit
104
105 SUBDIR=libxml2
106 GNUSTYLEPREFIX=$TARGET_BUILD_DIR/libxml2-gnustyle
107 ICONVPREFIX=$TARGET_BUILD_DIR/libiconv-gnustyle
108
109 # make sure things match our expectations
110 #
111 if [ ! -d $SUBDIR ]; then
112         echo no $SUBDIR dir in current dir `pwd`, cannot continue!
113         exit 1
114 fi
115
116
117 if [ x$ACTION = "xclean" ]; then
118
119         echo cleaning up...
120         rm -rf $GNUSTYLEPREFIX
121         cd $SUBDIR
122         make distclean
123
124 elif [ x$ACTION = "x" ]; then
125
126         echo building...
127
128         cd $SUBDIR
129
130         if [ ! -f Makefile ]; then
131
132                 echo no Makefile, running configure
133
134                 ./configure --prefix=$GNUSTYLEPREFIX --without-python --with-iconv=$ICONVPREFIX
135
136         fi
137
138         
139         if [ ! -d $GNUSTYLEPREFIX ]; then
140
141                 make install
142
143         fi
144
145
146 fi
147
148
149
150