-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathsubr.sh
98 lines (80 loc) · 2.1 KB
/
subr.sh
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
89
90
91
92
93
94
95
96
97
98
# Subroutines required by packages which build on top of buildrump.sh
#
# WARNING! These interfaces are not guaranteed to be stable. If you
# want to depend on their continued semantics, copypaste.
#
# the parrot routine
die ()
{
echo '>> ERROR:' >&2
echo ">> $*" >&2
exit 1
}
_checkrumpmake ()
{
[ -n "${RUMPMAKE}" ] || die 'routine requires $RUMPMAKE to be set'
[ -e "${RUMPMAKE}" ] || die ${RUMPMAKE} is not an executable
}
# adhoc "mtree" required for installaling a subset of userspace
# headers and libraries. maybe we can migrate to a proper use of
# NetBSD's mtree at some point?
usermtree ()
{
destbase=$1
INCSDIRS='adosfs altq arpa c++ c++/experimental c++/ext crypto
dev filecorefs fs i386 isofs miscfs
msdosfs net net80211 netatalk netbt netinet netinet6 netipsec
netisdn netkey netmpls netnatm netsmb nfs ntfs openssl pcap
ppath prop protocols rpc rpcsvc rumprun ssp sys ufs uvm x86'
for dir in ${INCSDIRS}; do
mkdir -p ${destbase}/include/$dir
done
mkdir -p ${destbase}/lib/pkgconfig
}
# echo names of normal libs (including optional prefix)
stdlibs ()
{
prefix=${1:+${1}/}
liblibs='libc libcrypt libipsec libkvm libm libnpf libpci libprop
libpthread librmt libutil liby libz'
extralibs='external/bsd/flex/lib
external/bsd/libpcap/lib'
for lib in ${liblibs}; do
echo ${prefix}lib/${lib}
done
for lib in ${extralibs}; do
echo ${prefix}${lib}
done
}
stdlibsxx ()
{
prefix=${1:+${1}/}
echo ${prefix}external/bsd/libc++
}
makeuserlib ()
{
_checkrumpmake
lib=$1
objarg=${2:+MAKEOBJDIR=${2}}
( cd ${lib}
${RUMPMAKE} ${objarg} obj
${RUMPMAKE} MKMAN=no MKLINT=no MKPROFILE=no MKYP=no \
MKNLS=no NOGCCERROR=1 HAVE_LIBGCC_EH=yes \
${objarg} ${STDJ} dependall
${RUMPMAKE} MKMAN=no MKLINT=no MKPROFILE=no MKYP=no \
${objarg} ${STDJ} install
)
}
userincludes ()
{
_checkrumpmake
rumpsrc=$1
shift
echo '>> installing userspace headers'
( cd ${rumpsrc}/include && ${RUMPMAKE} obj && ${RUMPMAKE} includes )
for lib in $*; do
( cd ${lib} && ${RUMPMAKE} obj )
( cd ${lib} && ${RUMPMAKE} includes )
done
echo '>> done installing headers'
}