Home | History | Annotate | Line # | Download | only in rump
listsrcdirs revision 1.41
      1 #!/bin/sh
      2 #
      3 #	$NetBSD: listsrcdirs,v 1.41 2019/09/12 17:35:58 bad Exp $
      4 #
      5 
      6 #
      7 # This script echoes the NetBSD source directories useful for
      8 # rump kernels.
      9 # Feed the output to whichever method you use to obtain NetBSD sources, e.g.
     10 #
     11 # ./listsrcdirs | xargs cvs -d anoncvs (at] anoncvs.netbsd.org:/cvsroot -z3 co -P
     12 #
     13 
     14 # Check that the intersection between all branches is the null set
     15 if [ "${LISTSRCDIRS_INSANITY}" != 'y' ]; then
     16 	if [ ! -z "$(LISTSRCDIRS_INSANITY=y sh $0 all | sort | uniq -d)" ]; then
     17 		echo $0: INTERNAL ERROR
     18 		exit 1
     19 	fi
     20 fi
     21 
     22 # default echomode (for compat)
     23 em='sys posix'
     24 
     25 # everything we support
     26 all='sys posix usr'
     27 
     28 # mini-getopt (so that we don't have to with getopt vs. getopts
     29 cvsmode=false
     30 if [ "${1}" = "-c" ]; then
     31 	cvsmode=true
     32 	shift
     33 fi
     34 
     35 [ ! -z "${*}" ] && em="${*}"
     36 [ "$em" = all ] && em="${all}"
     37 for x in ${em}; do
     38 	for y in ${all}; do
     39 		[ $x = $y ] && continue 2
     40 	done
     41 	echo invalid specifier $x
     42 	exit 1
     43 done
     44 
     45 iswanted ()
     46 {
     47 
     48 	for x in ${em}; do
     49 		if [ "$x" = "$1" ]; then
     50 			return 0
     51 		fi
     52 	done
     53 	return 1
     54 }
     55 
     56 lsrc ()
     57 {
     58 
     59 	what=$1
     60 	pfx=$2
     61 	shift 2
     62 
     63 	iswanted ${what} && for arg in $* ; do echo src${pfx}${arg} ; done
     64 }
     65 
     66 include_headerlist ()
     67 {
     68 	what=$1
     69 	pfx=$2
     70 	shift 2
     71 
     72 	if iswanted ${what}; then
     73 		[ -f headerlist ] \
     74 			|| { echo 'missing file: headerlist' 1>&2; exit 1; }
     75 		sed -E -e '/^#/d' -e '/^[  ]*$/d' \
     76 		    -e "/^\.?\/?/s##src${pfx}#" headerlist
     77 	fi
     78 }
     79 
     80 ARCHS="amd64 i386 x86 arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv"
     81 ARCHS_EXTRA="arm/arm32 Makefile"
     82 
     83 # sources necessary for building rump kernel components.  This list
     84 # depends on TOOLS_BUILDRUMP=yes.
     85 lsrc sys /			build.sh Makefile Makefile.inc
     86 lsrc sys /			tools common include share/mk
     87 lsrc sys /etc/			Makefile.params master.passwd group
     88 lsrc sys /lib/lib		c util
     89 lsrc sys /external/bsd/		flex mdocml byacc
     90 lsrc sys /external/cddl/	osnet
     91 lsrc sys /external/historical/	nawk
     92 lsrc sys /external/public-domain/	xz
     93 lsrc sys /bin/			cat pax
     94 lsrc sys /usr.bin/		make xinstall config mktemp sed tsort
     95 lsrc sys /usr.bin/		lorder join cksum m4 mkdep Makefile.inc
     96 lsrc sys /usr.bin/		rpcgen rump_wmd
     97 lsrc sys /usr.bin/		genassym grep stat uname
     98 lsrc sys /usr.sbin/		mtree
     99 lsrc sys /sbin/			mknod
    100 
    101 # sources hosted in the NetBSD tree that are required/useful
    102 # when targeting POSIX-y platforms
    103 lsrc posix /lib/lib		rump rumpdev rumpnet rumpvfs
    104 lsrc posix /lib/lib		rumpuser rumpclient rumphijack
    105 lsrc posix /usr.bin/		rump_server rump_allserver shmif_dumpbus
    106 
    107 # assorted userspace sources, mostly for configuration & diagnostics
    108 # NOTE! libc++ is handled below as a special case due to the NetBSD
    109 # dist directory consisting ~90% (50+MB) of tests unnecessary to us
    110 lsrc usr /lib/			i18n_module
    111 lsrc usr /lib/lib		crypt ipsec kvm m npf pci prop
    112 lsrc usr /lib/lib		pthread rmt y z
    113 lsrc usr /libexec/		ld.elf_so
    114 lsrc usr /bin/			chmod cp dd df ed ln ls mkdir mv
    115 lsrc usr /bin/			rm rmdir
    116 lsrc usr /sbin/			brconfig cgdconfig chown
    117 lsrc usr /sbin/			disklabel dump fdisk
    118 lsrc usr /sbin/			fsck fsck_ext2fs fsck_ffs fsck_msdos
    119 lsrc usr /sbin/			ifconfig
    120 lsrc usr /sbin/			modstat mount
    121 lsrc usr /sbin/			mount_ext2fs mount_ffs mount_msdos mount_tmpfs
    122 lsrc usr /sbin/			newfs newfs_ext2fs newfs_msdos
    123 lsrc usr /sbin/			ping ping6 raidctl reboot
    124 lsrc usr /sbin/			rndctl route setkey sysctl umount
    125 lsrc usr /usr.bin/		kdump ktrace mixerctl sockstat
    126 lsrc usr /usr.sbin/		arp dumpfs mdconfig ndp npf pcictl
    127 lsrc usr /usr.sbin/		rtadvd vnconfig wlanctl
    128 lsrc usr /external/bsd/		libelf libnv libpcap tcpdump wpa
    129 lsrc usr /crypto/		Makefile.openssl
    130 lsrc usr /crypto/dist/		ipsec-tools
    131 lsrc usr /crypto/external/bsd/	openssl
    132 
    133 
    134 # If -c is given, use CVS syntax to exclude large subdirectories
    135 # of sys.  Otherwise just do it wholesale.
    136 if ${cvsmode}; then
    137 	iswanted sys && echo \!src/sys/arch src/sys
    138 
    139 	iswanted usr && \
    140 	    echo \!src/external/bsd/libc++/dist/libcxx/test \
    141 	           src/external/bsd/libc++
    142 
    143 	# pick a few useful archs, namely those mentioned in buildrump.sh
    144 	for arch in ${ARCHS}; do
    145 		lsrc sys /sys/arch/${arch}/ include ${arch} Makefile
    146 	done
    147 	for extra in ${ARCHS_EXTRA}; do
    148 		lsrc sys /sys/arch/ ${extra}
    149 	done
    150 	# the includes mentioned in src/tools/headerlist are required
    151 	include_headerlist sys /sys/arch/
    152 else
    153 	lsrc sys / sys
    154 
    155 	lsrc usr /external /bsd/libc++
    156 fi
    157