split.sh (4884B)
1 copy_top() 2 { 3 srcdir_="$1" 4 dstdir_="$2" 5 files=`find "$srcdir_" -maxdepth 1 -mindepth 1 -type f` 6 for f in $files; do 7 cp -p "$f" "$dstdir_" 8 done 9 } 10 11 split_util() { 12 nssdir="$1" 13 dstdir="$2" 14 15 # Prepare a source tree only containing files to build nss-util: 16 # 17 # nss/dbm full directory 18 # nss/coreconf full directory 19 # nss top files only 20 # nss/lib top files only 21 # nss/lib/util full directory 22 23 # Copy everything. 24 cp -R $nssdir $dstdir 25 26 # Remove subdirectories that we don't want. 27 rm -rf $dstdir/cmd 28 rm -rf $dstdir/lib 29 rm -rf $dstdir/automation 30 rm -rf $dstdir/doc 31 32 # Start with an empty cmd lib directories to be filled selectively. 33 mkdir $dstdir/cmd 34 cp $nssdir/cmd/Makefile $dstdir/cmd 35 cp $nssdir/cmd/manifest.mn $dstdir/cmd 36 cp $nssdir/cmd/platlibs.mk $dstdir/cmd 37 cp $nssdir/cmd/platrules.mk $dstdir/cmd 38 39 # Copy some files at the top and the util subdirectory recursively. 40 mkdir $dstdir/lib 41 cp $nssdir/lib/Makefile $dstdir/lib 42 cp -R $nssdir/lib/util $dstdir/lib/util 43 } 44 45 split_softoken() { 46 nssdir="$1" 47 dstdir="$2" 48 49 # Prepare a source tree only containing files to build nss-softoken: 50 # 51 # nss/dbm full directory 52 # nss/coreconf full directory 53 # nss top files only 54 # nss/lib top files only 55 # nss/lib/freebl full directory 56 # nss/lib/softoken full directory 57 # nss/lib/softoken/dbm full directory 58 59 # Copy everything. 60 cp -R $nssdir $dstdir 61 62 # Skip gtests when building. 63 sed '/^DIRS = /s/ cpputil gtests$//' $nssdir/manifest.mn > $dstdir/manifest.mn-t && mv $dstdir/manifest.mn-t $dstdir/manifest.mn 64 65 # Remove subdirectories that we don't want. 66 rm -rf $dstdir/cmd 67 rm -rf $dstdir/tests 68 rm -rf $dstdir/lib 69 rm -rf $dstdir/pkg 70 rm -rf $dstdir/automation 71 rm -rf $dstdir/gtests 72 rm -rf $dstdir/cpputil 73 rm -rf $dstdir/doc 74 75 # Start with an empty lib directory and copy only what we need. 76 mkdir $dstdir/lib 77 copy_top $nssdir/lib $dstdir/lib 78 cp -R $nssdir/lib/dbm $dstdir/lib/dbm 79 cp -R $nssdir/lib/freebl $dstdir/lib/freebl 80 cp -R $nssdir/lib/softoken $dstdir/lib/softoken 81 cp -R $nssdir/lib/sqlite $dstdir/lib/sqlite 82 83 mkdir $dstdir/cmd 84 copy_top $nssdir/cmd $dstdir/cmd 85 cp -R $nssdir/cmd/bltest $dstdir/cmd/bltest 86 cp -R $nssdir/cmd/ecperf $dstdir/cmd/ecperf 87 cp -R $nssdir/cmd/dbtool $dstdir/cmd/dbtool 88 cp -R $nssdir/cmd/fbectest $dstdir/cmd/fbectest 89 cp -R $nssdir/cmd/fipstest $dstdir/cmd/fipstest 90 cp -R $nssdir/cmd/lib $dstdir/cmd/lib 91 cp -R $nssdir/cmd/lowhashtest $dstdir/cmd/lowhashtest 92 cp -R $nssdir/cmd/shlibsign $dstdir/cmd/shlibsign 93 94 mkdir $dstdir/tests 95 copy_top $nssdir/tests $dstdir/tests 96 97 cp -R $nssdir/tests/cipher $dstdir/tests/cipher 98 cp -R $nssdir/tests/common $dstdir/tests/common 99 cp -R $nssdir/tests/ec $dstdir/tests/ec 100 cp -R $nssdir/tests/lowhash $dstdir/tests/lowhash 101 102 cp $nssdir/lib/util/verref.h $dstdir/lib/freebl 103 cp $nssdir/lib/util/verref.h $dstdir/lib/softoken 104 cp $nssdir/lib/util/verref.h $dstdir/lib/softoken/legacydb 105 } 106 107 split_nss() { 108 nssdir="$1" 109 dstdir="$2" 110 111 # Prepare a source tree only containing files to build nss: 112 # 113 # nss/dbm full directory 114 # nss/coreconf full directory 115 # nss top files only 116 # nss/lib top files only 117 # nss/lib/freebl full directory 118 # nss/lib/softoken full directory 119 # nss/lib/softoken/dbm full directory 120 121 # Copy everything. 122 cp -R $nssdir $dstdir 123 124 # Remove subdirectories that we don't want. 125 rm -rf $dstdir/lib/freebl 126 rm -rf $dstdir/lib/softoken 127 rm -rf $dstdir/lib/util 128 rm -rf $dstdir/cmd/bltest 129 rm -rf $dstdir/cmd/fipstest 130 rm -rf $dstdir/cmd/rsaperf_low 131 132 # Copy these headers until the upstream bug is accepted 133 # Upstream https://bugzilla.mozilla.org/show_bug.cgi?id=820207 134 cp $nssdir/lib/softoken/lowkeyi.h $dstdir/cmd/rsaperf 135 cp $nssdir/lib/softoken/lowkeyti.h $dstdir/cmd/rsaperf 136 137 # Copy verref.h which will be needed later during the build phase. 138 cp $nssdir/lib/util/verref.h $dstdir/lib/ckfw/builtins/verref.h 139 cp $nssdir/lib/util/verref.h $dstdir/lib/nss/verref.h 140 cp $nssdir/lib/util/verref.h $dstdir/lib/smime/verref.h 141 cp $nssdir/lib/util/verref.h $dstdir/lib/ssl/verref.h 142 cp $nssdir/lib/util/templates.c $dstdir/lib/nss/templates.c 143 144 # FIXME: Skip util_gtest because it links with libnssutil.a. Note 145 # that we can't use libnssutil3.so instead, because util_gtest 146 # depends on internal symbols not exported from the shared library. 147 sed '/ util_gtest \\/d' $dstdir/gtests/manifest.mn > $dstdir/gtests/manifest.mn-t && mv $dstdir/gtests/manifest.mn-t $dstdir/gtests/manifest.mn 148 }