head	1.3;
access;
symbols;
locks; strict;
comment	@# @;


1.3
date	2013.01.25.00.29.26;	author svnexp;	state Exp;
branches;
next	1.2;

1.2
date	2012.04.21.15.09.22;	author jasone;	state Exp;
branches;
next	1.1;

1.1
date	2012.04.17.07.22.14;	author jasone;	state Exp;
branches;
next	;


desc
@@


1.3
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/245869
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@#!/bin/sh
# $FreeBSD$
#
# Usage: cd /usr/src/contrib/jemalloc
#        ./FREEBSD-upgrade <command> [args]
#
# At least the following ports are required when importing jemalloc:
# - devel/autoconf
# - devel/git
# - devel/gmake
# - textproc/docbook-xsl
# - textproc/libxslt
#
# The normal workflow for importing a new release is:
#
#   cd /usr/src/contrib/jemalloc
#
# Merge local changes that were made since the previous import:
#
#   ./FREEBSD-upgrade merge-changes
#   ./FREEBSD-upgrade rediff
#
# Extract latest jemalloc release.
#
#   ./FREEBSD-upgrade extract
#
# Fix patch conflicts as necessary, then regenerate diffs to update line
# offsets:
#
#   ./FREEBSD-upgrade rediff
#   ./FREEBSD-upgrade extract
#
# Do multiple buildworld/installworld rounds.  If problems arise and patches
# are needed, edit the code in ${work} as necessary, then:
#
#   ./FREEBSD-upgrade rediff
#   ./FREEBSD-upgrade extract
#
# The rediff/extract order is important because rediff saves the local
# changes, then extract blows away the work tree and re-creates it with the
# diffs applied.
#
# Finally, to clean up:
#
#  ./FREEBSD-upgrade clean

set -e

if [ ! -x "FREEBSD-upgrade" ] ; then
  echo "Run from within src/contrib/jemalloc/" >&2
  exit 1
fi

src=`pwd`
workname="jemalloc.git"
work="${src}/../${workname}" # merge-changes expects ${workname} in "..".
changes="${src}/FREEBSD-changes"

do_extract() {
  local rev=$1
  # Clone.
  rm -rf ${work}
  git clone git://canonware.com/jemalloc.git ${work}
  (
    cd ${work}
    if [ "x${rev}" != "x" ] ; then
      # Use optional rev argument to check out a revision other than HEAD on
      # master.
      git checkout ${rev}
    fi
    # Apply diffs before generating files.
    patch -p1 < "${src}/FREEBSD-diffs"
    find . -name '*.orig' -delete
    # Generate various files.
    ./autogen.sh --enable-cc-silence --enable-dss --enable-xmalloc \
      --enable-utrace --with-xslroot=/usr/local/share/xsl/docbook \
      --with-private-namespace=__jemalloc_
    gmake dist
  )
}

do_diff() {
  (cd ${work}; git add -A; git diff --cached) > FREEBSD-diffs
}

command=$1
shift
case "${command}" in
  merge-changes) # Merge local changes that were made since the previous import.
    rev=`cat VERSION |tr 'g' ' ' |awk '{print $2}'`
    # Extract code corresponding to most recent import.
    do_extract ${rev}
    # Compute local differences to the upstream+patches and apply them.
    (
      cd ..
      diff -ru -X ${src}/FREEBSD-Xlist ${workname} jemalloc > ${changes} || true
    )
    (
      cd ${work}
      patch -p1 < ${changes}
      find . -name '*.orig' -delete
    )
    # Update diff.
    do_diff
    ;;
  extract) # Extract upstream sources, apply patches, copy to contrib/jemalloc.
    rev=$1
    do_extract ${rev}
    # Delete existing files so that cruft doesn't silently remain.
    rm -rf ChangeLog COPYING VERSION doc include src
    # Copy files over.
    tar cf - -C ${work} -X FREEBSD-Xlist . |tar xvf -
    ;;
  rediff) # Regenerate diffs based on working tree.
    do_diff
    ;;
  clean) # Remove working tree and temporary files.
    rm -rf ${work} ${changes}
    ;;
  *)
    echo "Unsupported command: \"${command}\"" >&2
    exit 1
    ;;
esac
@


1.2
log
@SVN rev 234543 on 2012-04-21 15:09:22Z by jasone

Import jemalloc 606f1fdc3cdbc700717133ca56685313caea24bb (dev branch,
prior to 3.0.0 release), and mangle internal symbols.
@
text
@d12 1
@


1.1
log
@SVN rev 234370 on 2012-04-17 07:22:14Z by jasone

Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,
prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc.
The code being imported by this commit diverged from
lib/libc/stdlib/malloc.c in March 2010, which means that a portion of
the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries
for all subsequent releases.
@
text
@d75 2
a76 1
      --enable-utrace --with-xslroot=/usr/local/share/xsl/docbook
@

