summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 570d17498d88e4521a56131abbc93fcab6f9e242 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Maintainer: Davide Depau <davide@depau.eu>
# Contributor: Jonathan Shreckengost <jonathanshrek@gmail.com>

pkgbase="liblnk-git"
pkgname=("liblnk-git" "liblnk-tools-git" "python-liblnk-git" "python2-liblnk-git")
pkgver=20210417.r0.g0c9a2c8
pkgrel=1
pkgdesc="Library and tools to access the Windows Shortcut File (LNK) format"
arch=(x86_64)
license=(LGPL3)
url="https://github.com/libyal/liblnk"

depends=('libbfio-git')
makedepends=('git' 'python' 'python2' 'automake' 'autoconf' 'libtool' 'pkgconf')

source=("$pkgname::git+https://github.com/libyal/liblnk.git")
sha256sums=('SKIP')

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

prepare() {
  cd "$srcdir/$pkgname"
  ./synclibs.sh
  ./autogen.sh
}


build() {
  cd "$srcdir/$pkgname"

  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    runstatedir=/run \
    --sbindir=/usr/bin \
    --libexecdir=/usr/lib \
    --enable-python2 \
    --enable-python3

  make

  msg2 "Preparing files for packaging..."
  mkdir -p "$srcdir/package"
  make DESTDIR="$srcdir/package" install
}


package_liblnk-git() {
  provides=(liblnk)
  conflicts=(liblnk)
  cd "$srcdir/package"

  mkdir -p "$pkgdir/usr"

  # Copy libraries
  find usr/lib -minlevel 2 -type d | grep -v python | while read libdir; do
    mkdir -p "$pkgdir/$(dirname $libdir)"
    cp -Rd "$libdir" "$pkgdir/$libdir"
  done
  find usr/lib -not -type d | grep -v python | while read lib; do
    mkdir -p "$pkgdir/$(dirname $lib)"
    cp -d "$lib" "$pkgdir/$lib"
  done

  # Copy headers
  cp -Rd usr/include "$pkgdir/usr/include"

  # Copy manuals
  mkdir -p "$pkgdir/usr/share/man"
  cp -Rd usr/share/man/man3 "$pkgdir/usr/share/man/man3"
}


package_liblnk-tools-git() {
  pkgdesc="Command line tools for liblnk"
  provides=(liblnk-tools)
  conflicts=(liblnk-tools)
  depends=(liblnk-git)

  cd "$srcdir/package"
  mkdir -p "$pkgdir/usr"

  # Copy binaries
  cp -Rd usr/bin "$pkgdir/usr/bin"

  # Copy manuals
  mkdir -p "$pkgdir/usr/share/man"
  cp -Rd usr/share/man/man1 "$pkgdir/usr/share/man/man1"
}

package_python-liblnk-git() {
  pkgdesc="Python3 bindings for liblnk"
  provides=(python-liblnk)
  conflicts=(python-liblnk)
  depends=(python liblnk-git)

  cd "$srcdir/package"

  find usr/lib -type d | grep python3 | while read libdir; do
    mkdir -p "$pkgdir/$(dirname $libdir)"
    cp -Rd "$libdir" "$pkgdir/$libdir"
  done
  find usr/lib -not -type d | grep python3 | while read lib; do
    cp -d "$lib" "$pkgdir/$lib"
  done
}

package_python2-liblnk-git() {
  pkgdesc="Python2 bindings for liblnk"
  provides=(python2-liblnk)
  conflicts=(python2-liblnk)
  depends=(python2 liblnk-git)

  cd "$srcdir/package"

  find usr/lib -type d | grep python2 | while read libdir; do
    mkdir -p "$pkgdir/$(dirname $libdir)"
    cp -Rd "$libdir" "$pkgdir/$libdir"
  done
  find usr/lib -not -type d | grep python2 | while read lib; do
    mkdir -p "$pkgdir/$(dirname $lib)"
    cp -d "$lib" "$pkgdir/$lib"
  done
}