summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 77230df5fda5dc029c9da7b880d3c09e5719c174 (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
# Maintainer: Xeonacid <h.dwwwwww dot gmail.com>
# Maintainer: Luis Martinez <luis dot martinez at disroot dot org>
# Contributor: Dobroslaw Kijowski [dobo] <dobo90_at_gmail.com>

pkgname=lief
pkgver=0.16.2
pkgrel=1
pkgdesc='Library to instrument executable formats'
arch=('x86_64')
url='https://github.com/lief-project/lief'
license=(Apache-2.0)
depends=(
  mbedtls
)
optdepends=(
  'python: python bindings'
)
conflicts=(
  python-lief
)
makedepends=(
  cmake
  python
  nlohmann-json
  python-build
  python-installer
  python-wheel
  python-tomli
  python-scikit-build-core
  ninja
  python-cattrs
  python-packaging
  python-rich
  python-setuptools
  python-pydantic
  python-pydantic-core
  python-pyproject-metadata
  python-pathspec
  tl-expected
)
provides=(libLIEF.so)
source=("lief-${pkgver}.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('895ce0321b233a6d610ed89ccbe8dc4aa2cf0bb959919a1db0693ba264f3d29a')

prepare() {
  cd "LIEF-$pkgver/api/python"
  sed -i 's/==.*//' build-requirements.txt
}

build() {
  cd "LIEF-$pkgver"
  cmake \
    -B build \
    -G "Ninja" \
    -D CMAKE_BUILD_TYPE=Release \
    -D BUILD_SHARED_LIBS=ON \
    -D LIEF_EXAMPLES=OFF \
    -D LIEF_PYTHON_API=ON \
    -D LIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON \
    -D LIEF_OPT_MBEDTLS_EXTERNAL=ON \
    -D LIEF_OPT_EXTERNAL_EXPECTED=ON \
    -D LIEF_RUST_API=ON \
    -D LIEF_DEX=ON \
    -D LIEF_DOC=OFF \
    -D LIEF_PE=ON \
    -D LIEF_TESTS=OFF
  cmake --build build

  python -m build --wheel --no-isolation api/python
}

check() {
  cd "LIEF-$pkgver"
  #ctest --output-on-failure --test-dir build
  #python tests/run_pytest.py
  #python tests/run_tools_check.py
}

package() {
  cd "LIEF-$pkgver"
  DESTDIR="$pkgdir" cmake --install build

  python -m installer --destdir="$pkgdir" api/python/dist/*.whl
}