-
Notifications
You must be signed in to change notification settings - Fork 30
/
pkgbuild.py
executable file
·120 lines (105 loc) · 2.09 KB
/
pkgbuild.py
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
#!/usr/bin/env python3
import argparse
import json
import os
import subprocess
from jinja2 import Template
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'-i',
'--install',
action='store_true',
dest='install',
help='Install the package after building',
)
return parser.parse_args()
ARGS = parse_args()
PKGBUILD = """\
pkgname={{ name }}
pkgver={{ version }}
pkgrel=1
pkgdesc="A DAW, plugins and wave editor"
arch=('i686' 'x86_64' 'aarch64')
url="https://github.com/stargatedaw/stargate"
license=('GPL')
groups=()
depends=(
alsa-lib
fftw
lame
libsndfile
portaudio
portmidi
python
python-jinja
python-mutagen
python-numpy
python-psutil
python-pyaml
python-pyqt6
qt6-svg
rubberband
vorbis-tools
)
makedepends=(
alsa-lib
fftw
gcc
libsndfile
portaudio
portmidi
python
)
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=($pkgname-$pkgver.tar.gz)
noextract=()
md5sums=() #generate with 'makepkg -g'
prepare() {
git submodule init
git submodule update
}
build() {
cd "$srcdir/$pkgname-$pkgver"
PLAT_FLAGS="${CFLAGS}" make all
}
package() {
cd "$srcdir/$pkgname-$pkgver"
DESTDIR="$pkgdir/" make install
}
"""
orig_wd = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..',
),
)
os.chdir(orig_wd)
# Delete folders that the Arch package utils create, which cause the size of
# the tar files to grow
os.system('rm -rf src/stargate-[0-9][0-9].*')
with open("src/meta.json") as f:
j = json.load(f)
MAJOR_VERSION = j['version']['major']
MINOR_VERSION = j['version']['minor']
t = Template(PKGBUILD)
output = t.render(
name=MAJOR_VERSION,
version=MINOR_VERSION,
)
with open('PKGBUILD', 'w') as f:
f.write(output)
assert not os.system('scripts/src.sh')
assert not os.system('makepkg -g >>PKGBUILD')
assert not os.system('makepkg -fs')
if ARGS.install:
assert not os.system(
f'sudo pacman -U ./{MAJOR_VERSION}-{MINOR_VERSION}-*.zst',
)