summaryrefslogtreecommitdiff
path: root/ports/pre
blob: c30ddd854269a2e78760777e4e43c43ff98967c7 (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
#!/bin/sh
set -eu
repodir=$(pwd)
PATH="$repodir/toolchain/prefix/bin/:$PATH"
CC=x86_64-camellia-gcc
DESTDIR="$repodir/out/initrd/"
MAKEFLAGS="CC=$CC DESTDIR=$DESTDIR"
extra_files=

ensure_pre_was_loaded() { true; }

fetch() {
	test -e $downdir/$tarball || curl -L $url > $downdir/$tarball
	for file in $extra_files; do
		echo ${file##*/}
		test -e $downdir/${file##*/} || curl -L $file > $downdir/${file##*/}
	done
	checksum
}

checksum() {
	(cd $downdir; sha256sum --check $portdir/sha256sums)
}

post_unpack() { true; }
unpack() {
	test -d $tarball_dir && return
	fetch
	tar xf $downdir/$tarball
	patch
	post_unpack
}

post_patch() { true; }
patch() {
	if test -d $portdir/files/; then
		cp $portdir/files/* $tarball_dir/
	fi
	if test -d $portdir/patches/; then
		for patch in $portdir/patches/*; do
			echo $patch
			command patch -p0 -d $tarball_dir/ <$patch
		done
	fi
	post_patch
}

configure() {
	true
}

_make() {
	configure
	(cd $tarball_dir && make $MAKEFLAGS $*)
}

build() {
	unpack
	_make
}

clean() {
	_make clean
}

post_install() { true; }
install() {
	build
	_make install
	post_install
}