blob: 9db552166b6ccb3e7637a7960e7586bec9ed03f6 (
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
|
#!/bin/sh
#
# port a package from alpine linux
#
package=$1
aports_dir="/home/david/docs/proj/alpine/aports"
pkgbuild=$(find $aports_dir -name "$package" -type d | head -1)
[ ! -d "$pkgbuild" ] && printf "${RED}package not found" && exit 1
apkbuild="$pkgbuild/APKBUILD"
additional=$(ls $pkgbuild | grep -v ^APKBUILD$)
. $apkbuild
name=$pkgname
name=$(echo $pkgname | sed 's/py3-/python-/' )
version=$pkgver
# some use a _ pkg ver
[ ! -z "$_pkgver"] && version=$_pkgver
url=$(echo "$source" | head -1)
makedeps=""
for dep in $makedepends; do
makedeps="$makedeps $(echo $dep | sed -E 's/(-dev|-lib|-doc)$//g')"
done
builddir="repo/$name"
buildfile="$builddir/$name.xibuild"
mkdir -p $builddir
touch $buildfile
cat > $buildfile << EOF
#!/bin/sh
NAME="$name"
DESC="$pkgdesc"
MAKEDEPS="$makedeps"
PKG_VER=$version
EOF
grep "source=" $apkbuild | sed 's/source=/SOURCE=/g' | sed 's/pkgver/PKG_VER/g' | sed -r 's/([^"])$/\1"/' >> $buildfile
echo >> $buildfile
[ "${#additional}" != "0" ] && {
echo "ADDITIONAL=\"" >> $buildfile
for file in $additional; do
echo $file >> $buildfile
[ -f $pkgbuild/$file ] && cp $pkgbuild/$file $builddir/
done
echo '"' >> $buildfile
echo >> $buildfile
}
# TODO make this better
counting=false
while IFS= read -r line; do
case "$line" in
*"()"*"{") counting=true;;
sha512sums=*) counting=false;;
esac
$counting && printf "%s\n" "$line" >> $buildfile
done < $apkbuild
sed -i "s/\$pkgname/$name/g" $buildfile
sed -i "s/\$pkgver/\$PKG_VER/g" $buildfile
sed -i "s/\$pkgdir/\$PKG_DEST/g" $buildfile
sed -i "s/\$subpkgdir/\$PKG_DEST/g" $buildfile
sed -i "s/\$srcdir/\$BUILD_ROOT/g" $buildfile
sed -i "s/\$builddir/\$BUILD_ROOT/g" $buildfile
sed -i "s/^sha512sums=.*$//g" $buildfile
# ignore build and host options for configure; we arent cross compiling
sed -i "s/^\w*--build=//g" $buildfile
sed -i "s/^\w*--host=//g" $buildfile
sed -i 's/abuild-meson/meson --prefix=\/usr \\\n/' $buildfile
echo "press enter to edit"
read edit
vim -O $buildfile $apkbuild
|