Debian Codegraph @

scripts/compile-against-libxml2-source

raw symbols SCIP
1 #! /usr/bin/env bash
2 #
3 # Use this script to build libxml2 and libxslt from source, and then compile and link Nokogiri against them.
4 # Unless you're hacking on those libraries, consider using this command instead:
5 #
6 # bundle exec rake compile -- \\
7 # --with-xslt-source-dir=$(pwd)/../libxslt \\
8 # --with-xml2-source-dir=$(pwd)/../libxml2
9 #
10 set -eu
11
12 PREFIX="${HOME}/tmp/libxml2"
13 rm -rf "${PREFIX}"
14 mkdir -p "$PREFIX"
15
16 clean_p=0
17 if [[ ${1:-} == "--clean" ]] ; then
18 clean_p=1
19 shift
20 fi
21
22 function clean_and_configure_libxml2 {
23 make clean || true
24
25 ./configure --prefix="${PREFIX}" --with-legacy --without-python --without-readline --with-c14n --with-debug --with-threads --with-iconv=yes --host=x86_64-pc-linux-gnu CFLAGS="-O2 -g -std=c89 -D_XOPEN_SOURCE=700"
26 }
27
28 function clean_and_configure_libxslt {
29 make clean || true
30
31 ./configure --prefix="${PREFIX}" --without-python --with-libxml-prefix=$PREFIX --with-debug --host=x86_64-pc-linux-gnu CFLAGS="-O2 -g -std=c89 -D_XOPEN_SOURCE=700"
32 }
33
34 # libxml2
35 pushd ../libxml2
36 if [[ $clean_p -gt 0 ]] ; then
37 clean_and_configure_libxml2
38 fi
39 make install
40 popd
41
42 # libxslt
43 pushd ../libxslt
44 if [[ $clean_p -gt 0 ]] ; then
45 clean_and_configure_libxslt
46 fi
47 make install
48 popd
49
50 export LD_LIBRARY_PATH=${PREFIX}/lib
51 export CFLAGS="-I${PREFIX}/include/libxml2 -I${PREFIX}/include"
52 export LDFLAGS="-lxml2 -lxslt -L${PREFIX}/lib"
53
54 if [[ $clean_p -gt 0 ]] ; then
55 bundle exec rake clean
56 fi
57
58 bundle exec rake compile -- --enable-system-libraries
59
60 if [[ ${1:-} != "" ]] ; then
61 $*
62 fi