4 # Usage: cd /usr/src/contrib/jemalloc
5 # ./FREEBSD-upgrade <command> [args]
7 # At least the following ports are required when importing jemalloc:
11 # - textproc/docbook-xsl
13 # The normal workflow for importing a new release is:
15 # cd /usr/src/contrib/jemalloc
17 # Merge local changes that were made since the previous import:
19 # ./FREEBSD-upgrade merge-changes
20 # ./FREEBSD-upgrade rediff
22 # Extract latest jemalloc release.
24 # ./FREEBSD-upgrade extract
26 # Fix patch conflicts as necessary, then regenerate diffs to update line
29 # ./FREEBSD-upgrade rediff
30 # ./FREEBSD-upgrade extract
32 # Do multiple buildworld/installworld rounds. If problems arise and patches
33 # are needed, edit the code in ${work} as necessary, then:
35 # ./FREEBSD-upgrade rediff
36 # ./FREEBSD-upgrade extract
38 # The rediff/extract order is important because rediff saves the local
39 # changes, then extract blows away the work tree and re-creates it with the
42 # Finally, to clean up:
44 # ./FREEBSD-upgrade clean
48 if [ ! -x "FREEBSD-upgrade" ] ; then
49 echo "Run from within src/contrib/jemalloc/" >&2
54 workname="jemalloc.git"
55 work="${src}/../${workname}" # merge-changes expects ${workname} in "..".
56 changes="${src}/FREEBSD-changes"
62 git clone git://canonware.com/jemalloc.git ${work}
65 if [ "x${rev}" != "x" ] ; then
66 # Use optional rev argument to check out a revision other than HEAD on
70 # Apply diffs before generating files.
71 patch -p1 < "${src}/FREEBSD-diffs"
72 find . -name '*.orig' -delete
73 # Generate various files.
74 ./autogen.sh --enable-cc-silence --enable-dss --enable-xmalloc \
75 --enable-utrace --with-xslroot=/usr/local/share/xsl/docbook \
76 --with-private-namespace=__jemalloc_
82 (cd ${work}; git add -A; git diff --cached) > FREEBSD-diffs
88 merge-changes) # Merge local changes that were made since the previous import.
89 rev=`cat VERSION |tr 'g' ' ' |awk '{print $2}'`
90 # Extract code corresponding to most recent import.
92 # Compute local differences to the upstream+patches and apply them.
95 diff -ru -X ${src}/FREEBSD-Xlist ${workname} jemalloc > ${changes} || true
99 patch -p1 < ${changes}
100 find . -name '*.orig' -delete
105 extract) # Extract upstream sources, apply patches, copy to contrib/jemalloc.
108 # Delete existing files so that cruft doesn't silently remain.
109 rm -rf ChangeLog COPYING VERSION doc include src
111 tar cf - -C ${work} -X FREEBSD-Xlist . |tar xvf -
113 rediff) # Regenerate diffs based on working tree.
116 clean) # Remove working tree and temporary files.
117 rm -rf ${work} ${changes}
120 echo "Unsupported command: \"${command}\"" >&2