summaryrefslogtreecommitdiff
path: root/sys/rump/listsrcdirs
blob: a7bc0dccd206143e6a4bb67677cadcb27e08fc84 (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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/sh
#
#	$NetBSD: listsrcdirs,v 1.50 2020/04/25 15:42:14 bouyer Exp $
#

#
# This script echoes the NetBSD source directories useful for
# rump kernels.
# Feed the output to whichever method you use to obtain NetBSD sources, e.g.
#
# ./listsrcdirs | xargs cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot -z3 co -P
#

# Check that the intersection between all branches is the null set
if [ "${LISTSRCDIRS_INSANITY}" != 'y' ]; then
	if [ ! -z "$(LISTSRCDIRS_INSANITY=y sh $0 all | sort | uniq -d)" ]; then
		echo $0: INTERNAL ERROR
		exit 1
	fi
fi

# default echomode (for compat)
em='sys posix'

# everything we support
all='sys posix usr'

# mini-getopt (so that we don't have to with getopt vs. getopts
cvsmode=false
if [ "${1}" = "-c" ]; then
	cvsmode=true
	shift
fi

[ ! -z "${*}" ] && em="${*}"
[ "$em" = all ] && em="${all}"
for x in ${em}; do
	for y in ${all}; do
		[ $x = $y ] && continue 2
	done
	echo invalid specifier $x
	exit 1
done

iswanted ()
{

	for x in ${em}; do
		if [ "$x" = "$1" ]; then
			return 0
		fi
	done
	return 1
}

lsrc ()
{

	what=$1
	pfx=$2
	shift 2

	iswanted ${what} && for arg in $* ; do echo src${pfx}${arg} ; done
}

include_headerlist ()
{
	what=$1
	pfx=$2
	shift 2

	if iswanted ${what}; then
		[ -f headerlist ] \
			|| { echo 'missing file: headerlist' 1>&2; exit 1; }
		sed -E -e '/^#/d' -e '/^[  ]*$/d' \
		    -e "/^\.?\/?/s##src${pfx}#" headerlist \
		    | egrep -v "^src${pfx}($(echo "$@" | tr ' ' \|))/include"
	fi
}

ARCHS="amd64 i386 x86 xen arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv"
ARCHS_EXTRA="arm/arm32 Makefile"
# files listed in src/tools/Makefile.nbincludes
ARCHS_EXTRA="$ARCHS_EXTRA ews4800mips/include/pdinfo.h
ews4800mips/include/vtoc.h
dreamcast/include/endian_machdep.h
evbsh3/include/endian_machdep.h
hpcsh/include/endian_machdep.h
landisk/include/endian_machdep.h
mmeye/include/endian_machdep.h
sh3/include/endian_machdep.h"

# sources necessary for building rump kernel components.  This list
# depends on TOOLS_BUILDRUMP=yes.
lsrc sys /			build.sh Makefile Makefile.inc
lsrc sys /			tools common include share/mk
lsrc sys /etc/			Makefile.params master.passwd group
lsrc sys /lib/lib		c util
lsrc sys /external/bsd/		flex mdocml byacc
lsrc sys /external/cddl/	osnet
lsrc sys /external/historical/	nawk
lsrc sys /bin/			cat
lsrc sys /usr.bin/		make xinstall config mktemp sed tsort
lsrc sys /usr.bin/		lorder join cksum m4 mkdep Makefile.inc
lsrc sys /usr.bin/		rpcgen rump_wmd
lsrc sys /usr.bin/		genassym stat uname
lsrc sys /usr.sbin/		mtree

# sources hosted in the NetBSD tree that are required/useful
# when targeting POSIX-y platforms
lsrc posix /lib/lib		rump rumpdev rumpnet rumpvfs
lsrc posix /lib/lib		rumpuser rumpclient rumphijack
lsrc posix /usr.bin/		rump_server rump_allserver shmif_dumpbus

# assorted userspace sources, mostly for configuration & diagnostics
# NOTE! libc++ is handled below as a special case due to the NetBSD
# dist directory consisting ~90% (50+MB) of tests unnecessary to us
lsrc usr /lib/			i18n_module
lsrc usr /lib/lib		crypt ipsec kvm m npf pci prop
lsrc usr /lib/lib		pthread rmt wrap y z
lsrc usr /libexec/		ld.elf_so
lsrc usr /bin/			chmod cp dd df ed ln ls mkdir mv pax
lsrc usr /bin/			rm rmdir
lsrc usr /sbin/			brconfig cgdconfig chown
lsrc usr /sbin/			disklabel dump fdisk
lsrc usr /sbin/			fsck fsck_ext2fs fsck_ffs fsck_msdos
lsrc usr /sbin/			ifconfig mknod
lsrc usr /sbin/			modstat mount
lsrc usr /sbin/			mount_ext2fs mount_ffs mount_msdos mount_tmpfs
lsrc usr /sbin/			newfs newfs_ext2fs newfs_msdos
lsrc usr /sbin/			ping ping6 raidctl reboot
lsrc usr /sbin/			rndctl route setkey sysctl umount
lsrc usr /usr.bin/		kdump ktrace mixerctl sockstat
lsrc usr /usr.sbin/		arp dumpfs mdconfig ndp npf pcictl
lsrc usr /usr.sbin/		rtadvd vnconfig wlanctl
lsrc usr /external/bsd/		libnv libpcap tcpdump wpa
lsrc usr /crypto/		Makefile.openssl
lsrc usr /crypto/dist/		ipsec-tools
lsrc usr /crypto/external/bsd/	openssl


# If -c is given, use CVS syntax to exclude large subdirectories
# of sys.  Otherwise just do it wholesale.
if ${cvsmode}; then
	iswanted sys && \
	    echo \!src/sys/arch \
		 \!src/sys/external/gpl2/dts \
		 \!src/sys/external/bsd/drm \
		 \!src/sys/external/bsd/drm2 \
		src/sys

	iswanted usr && \
	    echo \!src/external/bsd/libc++/dist/libcxx/test \
	           src/external/bsd/libc++

	# pick a few useful archs, namely those mentioned in buildrump.sh
	for arch in ${ARCHS}; do
		lsrc sys /sys/arch/${arch}/ include ${arch} Makefile
	done
	# the includes mentioned in src/tools/headerlist are required.
	# but pull in only those that have not been pulled in by the previous
	# loop
	include_headerlist sys /sys/arch/ ${ARCHS}
	for extra in ${ARCHS_EXTRA}; do
		lsrc sys /sys/arch/ ${extra}
	done
else
	lsrc sys / sys

	lsrc usr /external /bsd/libc++
fi