forked from kiss-community/repo
general: Added pkgfile2puke
This commit is contained in:
parent
65279afb64
commit
c1a19c0996
61
pkgfile2puke
Executable file
61
pkgfile2puke
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# shellcheck source=/dev/null disable=2154,2016
|
||||||
|
#
|
||||||
|
# Convert a crux pkgfile to puke's format.
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf '\033[31mERROR>\033[m %s\n' "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
repo_setup() {
|
||||||
|
cd repo >/dev/null || die "Not in kiss repository."
|
||||||
|
mkdir "$name" || die "$name already exists."
|
||||||
|
cd "$name" >/dev/null || die "Can't cd to $name"
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgfile_read() {
|
||||||
|
[ -n "$1" ] || die "Need a pkgfile as input."
|
||||||
|
[ -f "$1" ] || die "File not found '$1'"
|
||||||
|
|
||||||
|
. "$1" || die "Syntax error in pkgfile."
|
||||||
|
|
||||||
|
[ -n "$name" ] || die "Field 'name' missing from pkgfile."
|
||||||
|
[ -n "$version" ] || die "Field 'version' missing from pkgfile."
|
||||||
|
[ -n "$release" ] || die "Field 'release' missing from pkgfile."
|
||||||
|
[ -n "$source" ] || die "Field 'source' missing from pkgfile."
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgfile_version() {
|
||||||
|
printf '%s\n' "$version $release" > version
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgfile_source() {
|
||||||
|
printf '%s\n' "$source" | while IFS=' ' read -r src; do
|
||||||
|
printf '%s\n' "$src"
|
||||||
|
done > sources
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgfile_build() {
|
||||||
|
sed 's/$BUILD/$pkg_dir/g' "$1" | while read -r line; do
|
||||||
|
[ "$line" = "}" ] && code=
|
||||||
|
[ "$code" ] && printf '%s\n' "$line"
|
||||||
|
|
||||||
|
[ "$line" = "build() {" ] && {
|
||||||
|
printf '%s\n\n' "#!/bin/sh -e"
|
||||||
|
code=1
|
||||||
|
}
|
||||||
|
done > build
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
pkgfile_read "$1"
|
||||||
|
|
||||||
|
repo_setup
|
||||||
|
|
||||||
|
pkgfile_version
|
||||||
|
pkgfile_source
|
||||||
|
pkgfile_build "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
13
repo/pkgconf/build
Normal file
13
repo/pkgconf/build
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--sysconfdir=/etc
|
||||||
|
|
||||||
|
mkdir -p "$pkg_dir/usr/bin"
|
||||||
|
|
||||||
|
make
|
||||||
|
make DESTDIR="$pkg_dir" install
|
||||||
|
|
||||||
|
cd "$pkg_dir/usr/bin" || exit 1
|
||||||
|
ln -s pkgconf pkg-config
|
1
repo/pkgconf/sources
Normal file
1
repo/pkgconf/sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://rabbit.dereferenced.org/~nenolod/distfiles/pkgconf-0.9.12.tar.bz2
|
1
repo/pkgconf/version
Normal file
1
repo/pkgconf/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.9.12 1
|
Loading…
Reference in New Issue
Block a user