summaryrefslogtreecommitdiff
path: root/unzip/build.sh
blob: bd26dc77d8fb333d4ac287fcbcce44a0764503ac (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
59
60
#!/bin/bash
name=unzip
version=6.0
revision=0
sources=(
    "https://downloads.sourceforge.net/infozip/${name}${version//./}.tar.gz"
)
build_depends=(
    "bzip2"
    "tar"
    "patch"
)
depends=(
    "bzip2"
)
debian_patchset=25


function prepare() {
    tar xf ${name}${version//./}.tar.gz
    cd ${name}${version//./}

    curl -LO http://ftp.debian.org/debian/pool/main/u/${name}/${name}_${version}-${debian_patchset}.debian.tar.xz
    tar xf ${name}_${version}-${debian_patchset}.debian.tar.xz

    msg "Apply debian patchset: ${debian_patchset}"
    for p in $(find debian/patches -type f -name "*.patch" | sort); do
        msg2 "$p"
        patch -p1 < "$p"
    done

}

function build() {
    DEFINES=
    if [[ $(uname -s) == Linux ]]; then
        DEFINES='-DACORN_FTYPE_NFS -DWILD_STOP_AT_DIR -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE -DNO_LCHMOD -DDATE_FORMAT=DF_YMD -DUSE_BZIP2 -DNOMEMCPY -DNO_WORKING_ISPRINT'
        LF2="$LDFLAGS"
    elif [[ $(uname -s) == Darwin ]]; then
        DEFINES="-DUNIX -DBSD -DUSE_BZIP2"
        LF2=""
    fi

    make -f unix/Makefile \
        D_USE_BZ2=-DUSE_BZIP2 \
        L_BZ2=-lbz2 \
        CF="$CFLAGS $CPPFLAGS -I. $DEFINES" \
        LF="$LDFLAGS" \
        prefix="${_prefix}" \
        unzips
}

function package() {
    mkdir -p "${_pkgdir}${_prefix}"

    [[ -f a.out ]] && mv a.out unzip
    make -f unix/Makefile \
        install \
        prefix="${_pkgdir}${_prefix}" || spm_debug_shell
}