Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 73 lines (53 sloc) 1.963 kb
6eb1162 Jordan Sissel - add work-in-progress to build packages with pkgsrc
authored
1 #!/bin/sh
2
3 if [ ! -f "mk/bsd.pkg.mk" ] ; then
4 # TODO(sissel): Maybe download pkgsrc ourselves.
5 echo "Current directory doesn't appear to be a pkgsrc tree. ($PWD)"
6 echo "I was expecting to find file: ./mk/bsd.pkg.mk"
7 exit 1
8 fi
9
10 if [ ! -f "build/usr/local/bin/bmake" ] ; then
11 # TODO(sissel): Maybe bootstrap ourselves.
12 echo "This script requires pkgsrc to be bootstrapped in a specific way."
13 echo "I expected to find file: build/usr/local/bin/bmake and did not"
bf4752c Aman Gupta removed all trailing whitespace: for i in $(git ls-files); do sed -i tmp...
tmm1 authored
14 echo
6eb1162 Jordan Sissel - add work-in-progress to build packages with pkgsrc
authored
15 echo "Bootstrap with:"
16 echo "SH=/bin/bash ./bootstrap/bootstrap --unprivileged --prefix $PWD/build/usr/local --pkgdbdir $PWD/pkgdb"
17 exit 1
18 fi
19
20 # TODO(sissel): put some flags.
21
22 LOCALBASE="/usr/local"
23 DESTDIR=$PWD/build
24
25 mkdir -p "$DESTDIR"
26
27 export PATH=$DESTDIR/$LOCALBASE/bin:$DESTDIR/$LOCALBASE/sbin:$PATH
28
29 for i in "$@" ; do
30 # process dependencies first before the final target.
31 set -- $(bmake -C "$@" show-depends-pkgpaths) "$@"
32 done
33
34 TARGETS="$*"
35
36 for target in $TARGETS; do
37 set --
38
39 eval "$(bmake -C $target show-vars-eval VARS="PKGNAME PKGVERSION")"
bf4752c Aman Gupta removed all trailing whitespace: for i in $(git ls-files); do sed -i tmp...
tmm1 authored
40 name="$(echo "$PKGNAME" | sed -e "s/-$PKGVERSION\$//")"
6eb1162 Jordan Sissel - add work-in-progress to build packages with pkgsrc
authored
41 orig_version=${PKGVERSION}
42 version=${PKGVERSION}-pkgsrc
43
44 # Purge old package
45 rm packages/All/$PKGNAME.tgz
46
47 pkg_delete $name > /dev/null 2>&1
48
49 bmake -C $target clean || exit 1
50 bmake -C $target USE_DESTDIR=yes LOCALBASE=$LOCALBASE PREFIX=$LOCALBASE \
51 DESTDIR=$DESTDIR SKIP_DEPENDS=yes \
52 clean package || exit 1
53
54 # Start building fpm args
bf4752c Aman Gupta removed all trailing whitespace: for i in $(git ls-files); do sed -i tmp...
tmm1 authored
55 set -- -n "$name" -v "$version" --prefix $LOCALBASE
56
6eb1162 Jordan Sissel - add work-in-progress to build packages with pkgsrc
authored
57 # Skip the pkgsrc package metadata files
58 set -- "$@" --exclude '+*'
59
60 # Handle deps
61 for dep in $(bmake -C $target show-depends-pkgpaths) ; do
62 eval "$(bmake -C $dep show-vars-eval VARS="PKGNAME PKGVERSION")"
63 PKGNAME="$(echo "$PKGNAME" | sed -e "s/-$PKGVERSION\$//")"
64 set -- "$@" -d "$PKGNAME (= $PKGVERSION-pkgsrc)"
65 done
66
bf4752c Aman Gupta removed all trailing whitespace: for i in $(git ls-files); do sed -i tmp...
tmm1 authored
67 set -- -s tar -t deb "$@"
68 set -- "$@" packages/All/$name-$orig_version.tgz
69 fpm "$@"
6eb1162 Jordan Sissel - add work-in-progress to build packages with pkgsrc
authored
70 done
bf4752c Aman Gupta removed all trailing whitespace: for i in $(git ls-files); do sed -i tmp...
tmm1 authored
71
6eb1162 Jordan Sissel - add work-in-progress to build packages with pkgsrc
authored
72
Something went wrong with that request. Please try again.