tbuild.mk - distro - linux distribution experiments
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
tbuild.mk (1409B)
---
1 <../config.mk
2
3 # target name for the pack
4 tarball = $pkg@$ver.tbz
5
6 # name of downloaded archive (/dev/null for git repos)
7 archive = `{basename $url 2>/dev/null || echo $pkg-$ver.tbz}
8
9 # create tarball with installed files in .rootfs/
10 $tarball: .rootfs post-install
11 tar -C .rootfs -cvj . > $tarball
12
13 # default rule to run before creating the tarball
14 # this is meant to be overwritten on a per-pack base when needed
15 post-install:QV: .rootfs
16 /bin/true
17
18 # build and install software under .rootfs/
19 .rootfs: $pkg-$ver
20 mkdir -p .rootfs
21 [ -f $pkg-$ver/configure ] && ( cd $pkg-$ver; ./configure $configureopts )
22 [ -d patches ] && cat patches/*.diff | ( cd $pkg-$ver; patch -Np1 )
23 make -e -j$NPROC -C $pkg-$ver DESTDIR=$(pwd)/.rootfs $MAKEFLAGS install
24
25 # download archive from remote site
26 $archive:
27 mkdir -p $(dirname $archive)
28 if [ -n "$git" ]; then
29 git clone --bare $git .repo
30 (cd .repo; git archive --prefix $pkg-$ver/ $ver) | bzip2 > $archive
31 rm -rf .repo
32 elif [ -n "$url" ]; then
33 curl -L $url > $archive
34 fi
35
36 # extract software (from either $url or $git)
37 $pkg-$ver:Q: $archive
38 case $archive in
39 *.tgz|*.tar.gz) z=z ;;
40 *.txz|*.tar.xz) z=J ;;
41 *.tbz|*.tar.bz2) z=j ;;
42 esac
43 srcdir=$(tar -xv$z < $archive | sed -n 1p | cut -d/ -f1)
44 [ "$srcdir" = "$pkg-$ver" ] || mv $srcdir $pkg-$ver
45 touch $pkg-$ver
46
47 # cleanup everything in the repo
48 clean:V:
49 rm -rf $tarball .rootfs $pkg-$ver $archive