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
14 # The normal workflow for importing a new release is:
16 # cd /usr/src/contrib/jemalloc
18 # Merge local changes that were made since the previous import:
20 # ./FREEBSD-upgrade merge-changes
21 # ./FREEBSD-upgrade rediff
23 # Extract latest jemalloc release.
25 # ./FREEBSD-upgrade extract
27 # Fix patch conflicts as necessary, then regenerate diffs to update line
30 # ./FREEBSD-upgrade rediff
31 # ./FREEBSD-upgrade extract
33 # Do multiple buildworld/installworld rounds. If problems arise and patches
34 # are needed, edit the code in ${work} as necessary, then:
36 # ./FREEBSD-upgrade rediff
37 # ./FREEBSD-upgrade extract
39 # The rediff/extract order is important because rediff saves the local
40 # changes, then extract blows away the work tree and re-creates it with the
43 # Finally, to clean up:
45 # ./FREEBSD-upgrade clean
49 if [ ! -x "FREEBSD-upgrade" ] ; then
50 echo "Run from within src/contrib/jemalloc/" >&2
55 workname="jemalloc.git"
56 work="${src}/../${workname}" # merge-changes expects ${workname} in "..".
57 changes="${src}/FREEBSD-changes"
63 git clone git://canonware.com/jemalloc.git ${work}
66 if [ "x${rev}" != "x" ] ; then
67 # Use optional rev argument to check out a revision other than HEAD on
71 # Apply diffs before generating files.
72 patch -p1 < "${src}/FREEBSD-diffs"
73 find . -name '*.orig' -delete
74 # Generate various files.
75 ./autogen.sh --enable-cc-silence --enable-dss --enable-xmalloc \
76 --enable-utrace --with-xslroot=/usr/local/share/xsl/docbook \
77 --with-private-namespace=__jemalloc_
83 (cd ${work}; git add -A; git diff --cached) > FREEBSD-diffs
89 merge-changes) # Merge local changes that were made since the previous import.
90 rev=`cat VERSION |tr 'g' ' ' |awk '{print $2}'`
91 # Extract code corresponding to most recent import.
93 # Compute local differences to the upstream+patches and apply them.
96 diff -ru -X ${src}/FREEBSD-Xlist ${workname} jemalloc > ${changes} || true
100 patch -p1 < ${changes}
101 find . -name '*.orig' -delete
106 extract) # Extract upstream sources, apply patches, copy to contrib/jemalloc.
109 # Delete existing files so that cruft doesn't silently remain.
110 rm -rf ChangeLog COPYING VERSION doc include src
112 tar cf - -C ${work} -X FREEBSD-Xlist . |tar xvf -
114 rediff) # Regenerate diffs based on working tree.
117 clean) # Remove working tree and temporary files.
118 rm -rf ${work} ${changes}
121 echo "Unsupported command: \"${command}\"" >&2