summaryrefslogtreecommitdiff
path: root/libxml2/build.sh
blob: d42157c2bc459f21edb86fe355c5e47e52fc1b5e (plain) (blame)
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
#!/bin/bash
name=libxml2
version=2.9.9
revision=0
sources=(
    "https://github.com/GNOME/${name}/archive/v${version}.tar.gz"
)
build_depends=(
    "automake"
    "autoconf"
    "libtool"
    "pkgconf"
    "python"
)
depends=(
    "icu"
    "libiconv"
    "ncurses"
    "readline"
    "xz"
    "zlib"
)

lib_type=so

function prepare() {
    tar xf v${version}.tar.gz
    cd ${name}-${version}
    if [[ $(uname -s) == Darwin ]]; then
        lib_type=dylib
        LDFLAGS="-L${_runtime}"
    fi
}

function build() {
    NOCONFIGURE=1 sh autogen.sh
    ./configure --prefix="${_prefix}" \
        --with-icu \
        --with-history \
        --with-threads \
        --with-python="${_runtime}/bin/python3"	\
        --with-iconv="${_runtime}" \
        --with-libz="${_runtime}" \
        --with-lzma="${_runtime}"
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' libtool
    PYTHONHASHSEED=0 make -j${_maxjobs}
}

function package() {
    make install DESTDIR="${_pkgdir}"
    if [[ $(uname -s) == Darwin ]]; then
        pushd "${_pkgdir}${_prefix}"
            for prog in bin/xmlcatalog bin/xmllint; do
                install_name_tool -add_rpath "${_runtime}"/lib "$prog"
            done
        popd
    fi
}