summaryrefslogtreecommitdiff
path: root/tk/build.sh
blob: 20f107552876727fc4a4b6b1191fca071fdc8b86 (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
#!/bin/bash
name=tk
version=8.6.9
version_full="${version}.1"
revision=0
sources=(
    "https://prdownloads.sourceforge.net/tcl/${name}${version_full}-src.tar.gz"
)
build_depends=(
    "pkgconf"
    "tar"
    "tcl==${version}"
)
depends=(
    "tcl==${version}"
)
[[ $(uname -s) == Linux ]] && depends+=("libX11")

lib_type=so

function prepare() {
    tar xf ${name}${version_full}-src.tar.gz
    cd ${name}${version}

    if [[ $(uname -s) == Darwin ]]; then
        LDFLAGS="-L${_runtime}/lib"
        lib_type=dylib
    fi
}

function build() {
    cd unix

    # Patch bad library path (originally was, "path1:path2:path3:...")
    cp -a Makefile.in Makefile.in.old
    sed -e "s|^LIB_RUNTIME_DIR.*$|LIB_RUNTIME_DIR=${_runtime}/lib|" Makefile.in.old > Makefile.in

    if [[ $(uname -s) == Darwin ]]; then
        opts="--disable-framework"
    fi

    ./configure --prefix=${_prefix} \
        ${opts} \
        --with-tcl=${_runtime}/lib \
        --with-x
    make -j${_maxjobs}
}

function package() {
    make install DESTDIR="${_pkgdir}"
    pushd "${_pkgdir}${_prefix}"/bin
        ln -s wish${version%.*} "${_pkgdir}${_prefix}"/bin/wish
    popd
    chmod 755 "${_pkgdir}${_prefix}"/lib/*.${lib_type}
}