summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bd00e148976ba0b1cbb3e9d616a8ef26f1a16591 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Maintainer: Imperator Storm <ImperatorStorm11@protonmail.com>
# Contributor: Guillaume Horel <guillaume.horel@gmail.com>

pkgbase=minizip-git
pkgname=(minizip-git minizip-static-git)
pkgdesc="Fork of the popular zip manipulation library found in the zlib distribution."
pkgver=4.0.5.r7.g990f512
pkgrel=2
arch=('x86_64' 'aarch64' 'i686')
license=('Zlib')
url="https://github.com/zlib-ng/minizip-ng"
depends=('zstd' 'bzip2' 'openssl>=3.0.7' 'libbsd')
makedepends=('git' 'cmake')
source=("${pkgname}::git+https://github.com/zlib-ng/minizip-ng#branch=develop")
sha256sums=('SKIP')
options=(staticlibs)

pkgver() {
  cd ${srcdir}/${pkgbase}
    git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    cd ${srcdir}/${pkgbase}
    if [[ -d build ]]; then
      rm -rf build
    fi
    if [[ -d build-static ]]; then
      rm -rf build-static
    fi
    mkdir build
    mkdir build-static
    if [[ -d build-ng ]]; then
      rm -rf build-ng
    fi
    if [[ -d build-ng-static ]]; then
      rm -rf build-ng-static
    fi
    mkdir build-ng
    mkdir build-ng-static
}

build() {
    cd ${srcdir}/${pkgbase}/build
    cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -DBUILD_SHARED_LIBS=ON \
        -DMZ_COMPAT=ON \
        -DCMAKE_INSTALL_INCLUDEDIR=/usr/include/minizip \
        -DCMAKE_BUILD_TYPE=None \
        ..
    make
    cd ../build-static
    cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -DBUILD_SHARED_LIBS=OFF \
        -DMZ_COMPAT=ON \
        -DCMAKE_INSTALL_INCLUDEDIR=/usr/include/minizip \
        -DCMAKE_BUILD_TYPE=None \
        ..
    make
    cd ../build-ng
    cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -DMZ_PROJECT_SUFFIX="-ng" \
        -DBUILD_SHARED_LIBS=ON \
        ..
    make
    cd ../build-ng-static
    cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -DMZ_PROJECT_SUFFIX="-ng" \
        -DBUILD_SHARED_LIBS=OFF \
        ..
    make
}

package_minizip-git() {
    conflicts=('minizip' 'minizip-ng')
    provides=('minizip' 'minizip-ng' 'libminizip.so=4')
    cd ${srcdir}/${pkgbase}/build
    make DESTDIR="${pkgdir}" install
    cd ${srcdir}/${pkgbase}/build-ng
    make DESTDIR="${pkgdir}" install
    rm -rf "${pkgdir}/usr/include/"{,un}"zip.h" # conflict with libzip
    install -D -m644 "${srcdir}/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/minizip/LICENSE"
}
package_minizip-static-git() {
    depends=(minizip-git)
    conflicts=('minizip-static' 'minizip-ng-static')
    provides=('minizip-static' 'minizip-ng-static')
    mkdir -p "${pkgdir}/usr/lib/"
    mv "${srcdir}/minizip-git/build-static/"*.a  "${pkgdir}/usr/lib/"
    mv "${srcdir}/minizip-git/build-ng-static/"*.a  "${pkgdir}/usr/lib/"
}