about summary refs log tree commit diff
path: root/xnew
blob: 1310d10b971820841f4ecc682410fce5f546f3b6 (plain) (blame)
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
#!/bin/sh -e
# xnew PKG - create XBPS template template

PKG=${1?no package name given}
srcdir=$(xdistdir)/srcpkgs
shift

homepage=
version=
distfiles=
case "$PKG" in
*://*)
	# guesstimate defaults
	homepage=${PKG%/*}/
	PKG=${PKG##*/}
	ext=${PKG##*-}
	again=true
	while $again; do
		again=false
		case "$ext" in
		[0-9]*)
			version=$version${ext%%.*}.
			ext=${ext#*.}
			again=true
		esac
	done
	version=${version%.}
	PKG=${PKG%-*}
	distfiles="$homepage\${pkgname}-\${version}.$ext"
esac

mkdir $srcdir/$PKG

cat >$srcdir/$PKG/template <<EOF
# Template file for '$PKG'
pkgname=$PKG
version=$version
revision=1
#wrksrc=
#create_wrksrc=yes
#archs="i686 x86_64"
build_style=gnu-configure
#configure_args=""
#make_build_args=""
#make_install_args=""
#conf_files=""
#make_dirs="/var/log/dir 0755 root root"
hostmakedepends=""
makedepends=""
depends=""
short_desc=""
maintainer="$(git config user.name) <$(git config user.email)>"
license="GPL-3.0-or-later"
homepage="$homepage"
distfiles="$distfiles"
checksum=badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb
EOF

for subpkg; do
	ln -sr -- "$srcdir/$PKG" "$srcdir/$subpkg"
	cat >>$srcdir/$PKG/template <<EOF

${subpkg}_package() {
EOF
	case $subpkg in
	*-devel) cat >>$srcdir/$PKG/template <<EOF
	depends="\${sourcepkg}>=\${version}_\${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/share/man/man3
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
EOF
		;;
	*) cat >>$srcdir/$PKG/template <<EOF
	pkg_install() {
		#vmove path
	}
EOF
		;;
	esac
	echo "}" >>$srcdir/$PKG/template
done

exec ${EDITOR:-vi} +3 $srcdir/$PKG/template