]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Merge branch 'master' into divVerent/crypto2
authorRudolf Polzer <divVerent@alientrap.org>
Fri, 20 Aug 2010 12:23:54 +0000 (14:23 +0200)
committerRudolf Polzer <divVerent@alientrap.org>
Fri, 20 Aug 2010 12:23:54 +0000 (14:23 +0200)
Conflicts:
all

19 files changed:
all
misc/buildfiles/win64/SDL.dll [new file with mode: 0644]
misc/buildfiles/win64/libcurl-4.dll [new file with mode: 0644]
misc/buildfiles/win64/libfreetype-6.dll [new file with mode: 0644]
misc/buildfiles/win64/libjpeg.dll [new file with mode: 0644]
misc/buildfiles/win64/libmodplug-1.dll [new file with mode: 0644]
misc/buildfiles/win64/libogg.dll [new file with mode: 0644]
misc/buildfiles/win64/libpng14.dll [new file with mode: 0644]
misc/buildfiles/win64/libtheora.dll [new file with mode: 0644]
misc/buildfiles/win64/libvorbis.dll [new file with mode: 0644]
misc/buildfiles/win64/libvorbisfile.dll [new file with mode: 0644]
misc/buildfiles/win64/vorbisenc.dll [new file with mode: 0644]
misc/buildfiles/win64/zlib1.dll [new file with mode: 0644]
misc/tools/cached-converter.sh
misc/tools/git-pk3-import [new file with mode: 0755]
misc/tools/git-pk3-merge [new file with mode: 0755]
misc/tools/normalmap.sh [new file with mode: 0755]
misc/tools/update-nexcompat.sh [new file with mode: 0755]
misc/tools/xonotic-map-compiler-autobuild

diff --git a/all b/all
index 2bc1bf9bf5ffbe6e1e89802bf73465b8aa22c195..64a28e58719d8f9535caa6277a9ff6531d0c4cef 100755 (executable)
--- a/all
+++ b/all
@@ -251,7 +251,7 @@ case "$cmd" in
                                        verbose git config remote.origin.url "$url"
                                        verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
 
-                                       verbose git config remote.origin.autocrlf input
+                                       verbose git config core.autocrlf input
 
                                        r=`git symbolic-ref HEAD`
                                        r=${r#refs/heads/}
@@ -286,6 +286,11 @@ case "$cmd" in
                misc/tools/xonotic-map-compiler-autobuild download
                ;;
        checkout|switch)
+               checkoutflags=
+               if [ x"$1" = x"-f" ]; then
+                       checkoutflags=-f
+                       shift
+               fi
                remote=$1
                branch=$2
                if [ -z "$branch" ]; then
@@ -306,18 +311,18 @@ case "$cmd" in
                        b=$branch
                        if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
                                exists=true
-                               verbose git checkout "$b"
+                               verbose git checkout $checkoutflags "$b"
                        elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
                                exists=true
-                               verbose git checkout --track -b "$b" "$remote/$b"
+                               verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
                        else
                                b=`repobranch "$d"`
                                if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
                                        exists=true
-                                       verbose git checkout "$b"
+                                       verbose git checkout $checkoutflags "$b"
                                elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
                                        exists=true
-                                       verbose git checkout --track -b "$b" "$remote/$b"
+                                       verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
                                else
                                        echo "WTF? Not even branch $b doesn't exist in $d"
                                        exit 1
@@ -556,13 +561,8 @@ case "$cmd" in
                                        MAKEFLAGS=-j$ncpus
                                fi
                        fi
-                       case "`uname`" in
-                               Linux|*BSD)
-                                       MAKEFLAGS="$MAKEFLAGS DP_LINK_TO_LIBJPEG=1"
-                                       ;;
-                       esac
                        if [ -n "$WE_HATE_OUR_USERS" ]; then
-                               MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
+                               MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
                        fi
                fi
 
@@ -607,7 +607,7 @@ case "$cmd" in
        run)
                if [ -n "$WE_HATE_OUR_USERS" ]; then
                        client=
-                       export PATH="$d0/misc/buildfiles/win64:$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
+                       export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
                elif [ x"`uname`" = x"Darwin" ]; then
                        export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS:$d0/d0_blind_id/.libs"
                        export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
@@ -807,7 +807,7 @@ case "$cmd" in
                                        elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
                                                git checkout "$realbase"
                                                org=`git rev-parse HEAD`
-                                               if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1   ' >/dev/null; }; then
+                                               if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
                                                        git reset --hard "$org"
                                                        GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
                                                        reportdo4 cat "$t"
@@ -984,39 +984,40 @@ case "$cmd" in
                ;;
        release-engine-win32)
                verbose "$SELF" release-compile win32 \
-                       'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -DSUPPORTDIRECTX -DUSE_WSPIAPI_H -I$HOME/dp.win32/include -L$HOME/dp.win32/lib" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG="$HOME/dp.win32/bin/sdl-config"' \
+                       'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I$HOME/dp.win32/include -L$HOME/dp.win32/lib" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG="$HOME/dp.win32/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
                        win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
                        release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
                ;;
        release-engine-win64)
                verbose "$SELF" release-compile win64 \
-                       'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -DSUPPORTDIRECTX -DUSE_WSPIAPI_H -I$HOME/dp.win64/include -L$HOME/dp.win64/lib" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG="$HOME/dp.win64/bin/sdl-config" LDFLAGS_WINCOMMON=""' \
+                       'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I$HOME/dp.win64/include -L$HOME/dp.win64/lib" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG="$HOME/dp.win64/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
                        win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
-                       release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl-x64.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated-x64.exe'
+                       'sv-release cl-release' 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated-x64.exe'
+                       # release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl-x64.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated-x64.exe'
                ;;
        release-engine-osx)
                # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
                verbose "$SELF" release-compile osx \
-                       'STRIP=: CC="gcc -g -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I$HOME/dp.osx/include -L$HOME/dp.osx/lib -fno-reorder-blocks"' \
+                       'STRIP=: CC="gcc -g -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I$HOME/dp.osx/include -L$HOME/dp.osx/lib -fno-reorder-blocks" LIB_JPEG= CFLAGS_LIBJPEG=' \
                        all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
                        'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin' 'darkplaces-dedicated:xonotic-osx-dedicated'
                ;;
        release-engine-linux32)
                verbose "$SELF" release-compile linux32 \
-                       'STRIP=: CC="gcc -m32 -g -Wl,--hash-style=sysv -I$HOME/dp.linux32/include -L$HOME/dp.linux32/lib" DP_MODPLUG_STATIC_LIBDIR=$HOME/dp.linux32/lib DP_LINK_TO_LIBJPEG=1' \
+                       'STRIP=: CC="gcc -m32 -g -Wl,--hash-style=sysv -I$HOME/dp.linux32/include -L$HOME/dp.linux32/lib" DP_MODPLUG_STATIC_LIBDIR=$HOME/dp.linux32/lib LIB_JPEG=$HOME/dp.linux32/lib/libjpeg.a' \
                        all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
                        release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
                ;;
        release-engine-linux64)
                verbose "$SELF" release-compile linux64 \
-                       'STRIP=: CC="gcc -m64 -g -Wl,--hash-style=sysv -I$HOME/dp.linux64/include -L$HOME/dp.linux64/lib" DP_MODPLUG_STATIC_LIBDIR=$HOME/dp.linux64/lib DP_LINK_TO_LIBJPEG=1' \
+                       'STRIP=: CC="gcc -m64 -g -Wl,--hash-style=sysv -I$HOME/dp.linux64/include -L$HOME/dp.linux64/lib" DP_MODPLUG_STATIC_LIBDIR=$HOME/dp.linux64/lib LIB_JPEG=$HOME/dp.linux64/lib/libjpeg.a' \
                        all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
                        release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
                ;;
        release-engine)
+               verbose "$SELF" release-engine-win64
                verbose "$SELF" release-engine-osx
                verbose "$SELF" release-engine-win32
-               # verbose "$SELF" release-engine-win64
                verbose "$SELF" release-engine-linux32
                verbose "$SELF" release-engine-linux64
                ;;
@@ -1187,14 +1188,12 @@ case "$cmd" in
                verbose zip -0yr Xonotic-$stamp-low.zip \
                        Xonotic/data/xonotic-$stamp-data-low.pk3 \
                        Xonotic/data/xonotic-$stamp-maps-low.pk3 \
-                       Xonotic/data/xonotic-$stamp-music-low.pk3 \
-                       Xonotic/data/xonotic-$stamp-nexcompat.pk3
+                       Xonotic/data/xonotic-$stamp-music-low.pk3
                verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
                verbose zip -0yr Xonotic-$stamp-lowdds.zip \
                        Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
                        Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
-                       Xonotic/data/xonotic-$stamp-music-low.pk3 \
-                       Xonotic/data/xonotic-$stamp-nexcompat.pk3
+                       Xonotic/data/xonotic-$stamp-music-low.pk3
                verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
                verbose zip -0yr Xonotic-$stamp-high.zip \
                        Xonotic/data/xonotic-$stamp-data-raw.pk3 \
diff --git a/misc/buildfiles/win64/SDL.dll b/misc/buildfiles/win64/SDL.dll
new file mode 100644 (file)
index 0000000..5d25cd9
Binary files /dev/null and b/misc/buildfiles/win64/SDL.dll differ
diff --git a/misc/buildfiles/win64/libcurl-4.dll b/misc/buildfiles/win64/libcurl-4.dll
new file mode 100644 (file)
index 0000000..4474020
Binary files /dev/null and b/misc/buildfiles/win64/libcurl-4.dll differ
diff --git a/misc/buildfiles/win64/libfreetype-6.dll b/misc/buildfiles/win64/libfreetype-6.dll
new file mode 100644 (file)
index 0000000..050ff17
Binary files /dev/null and b/misc/buildfiles/win64/libfreetype-6.dll differ
diff --git a/misc/buildfiles/win64/libjpeg.dll b/misc/buildfiles/win64/libjpeg.dll
new file mode 100644 (file)
index 0000000..a7440c4
Binary files /dev/null and b/misc/buildfiles/win64/libjpeg.dll differ
diff --git a/misc/buildfiles/win64/libmodplug-1.dll b/misc/buildfiles/win64/libmodplug-1.dll
new file mode 100644 (file)
index 0000000..e19b19d
Binary files /dev/null and b/misc/buildfiles/win64/libmodplug-1.dll differ
diff --git a/misc/buildfiles/win64/libogg.dll b/misc/buildfiles/win64/libogg.dll
new file mode 100644 (file)
index 0000000..fcf7152
Binary files /dev/null and b/misc/buildfiles/win64/libogg.dll differ
diff --git a/misc/buildfiles/win64/libpng14.dll b/misc/buildfiles/win64/libpng14.dll
new file mode 100644 (file)
index 0000000..a0787e2
Binary files /dev/null and b/misc/buildfiles/win64/libpng14.dll differ
diff --git a/misc/buildfiles/win64/libtheora.dll b/misc/buildfiles/win64/libtheora.dll
new file mode 100644 (file)
index 0000000..fe78cd5
Binary files /dev/null and b/misc/buildfiles/win64/libtheora.dll differ
diff --git a/misc/buildfiles/win64/libvorbis.dll b/misc/buildfiles/win64/libvorbis.dll
new file mode 100644 (file)
index 0000000..e0a34d3
Binary files /dev/null and b/misc/buildfiles/win64/libvorbis.dll differ
diff --git a/misc/buildfiles/win64/libvorbisfile.dll b/misc/buildfiles/win64/libvorbisfile.dll
new file mode 100644 (file)
index 0000000..cb8aca5
Binary files /dev/null and b/misc/buildfiles/win64/libvorbisfile.dll differ
diff --git a/misc/buildfiles/win64/vorbisenc.dll b/misc/buildfiles/win64/vorbisenc.dll
new file mode 100644 (file)
index 0000000..513a5f5
Binary files /dev/null and b/misc/buildfiles/win64/vorbisenc.dll differ
diff --git a/misc/buildfiles/win64/zlib1.dll b/misc/buildfiles/win64/zlib1.dll
new file mode 100644 (file)
index 0000000..dd9a376
Binary files /dev/null and b/misc/buildfiles/win64/zlib1.dll differ
index ccbe0bb862a507b41b0b85d1cf905b0e5408d636..72f427c71d89bf150ac23dd4a4a40ba36431c74f 100755 (executable)
@@ -105,8 +105,10 @@ reduce_ogg_ogg()
 {
        i=$1; shift; shift
        o=$1; shift; shift
+       tags=`vorbiscomment -R -l "$i"`
        oggdec -o "$tmpdir/x.wav" "$i" && \
        oggenc -q"$1" -o "$o" "$tmpdir/x.wav"
+       echo "$tags" | vorbiscomment -R -w "$o"
 }
 
 reduce_wav_ogg()
@@ -175,6 +177,7 @@ for F in "$@"; do
        will_jpeg=$do_jpeg
        will_dds=$do_dds
        case "$f" in
+               *_bump) will_dds=false ;;
                ./models/player/*) will_dds=false ;;
                ./textures/*) ;;
                ./models/*) ;;
diff --git a/misc/tools/git-pk3-import b/misc/tools/git-pk3-import
new file mode 100755 (executable)
index 0000000..ee081d4
--- /dev/null
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+# git-pk3-import: Import a PK3 into a branch of a bare Git repo.
+
+set -x
+
+# Helpers
+
+die()
+{
+    echo "$(basename "$0"): error: $*" >&2
+    exit 1
+}
+
+usage()
+{
+    cat <<EOF
+Usage:
+
+  # mandatory
+  export GIT_DIR=/path/to/xonotic-maps.pk3dir.git # absolute path
+  export GIT_WORK_TREE=/tmp/worktree # pk3 is extracted here
+  # optional
+  export GIT_AUTHOR_NAME="Some Guy"
+  export GIT_AUTHOR_EMAIL="someguy@example.com"
+
+  $(basename $0) nick branch map.pk3 [changes.txt]
+
+EOF
+}
+
+# Check usage
+
+[ $# -ge 3 -a $# -le 4 ] || {
+    usage
+    die "wrong number of arguments"
+}
+
+[ -z "$GIT_DIR" ] && {
+    usage
+    die "GIT_DIR not set"
+}
+
+[ -z "$GIT_WORK_TREE" ] && {
+    usage
+    die "GIT_WORK_TREE not set"
+}
+
+[ -z "$(ls -A "$GIT_WORK_TREE")" ] ||
+die "GIT_WORK_TREE is not empty"
+
+nick="$1"
+branch=$(git check-ref-format --print "$nick/$2") ||
+die "malformed branch name '$nick/$2'"
+pk3path="$3"
+pk3name="$(basename "$pk3path")"
+changes="$4"
+
+# Set up commit info
+
+[ -z "$GIT_AUTHOR_NAME" ] && export GIT_AUTHOR_NAME="$nick"
+[ -z "$GIT_AUTHOR_EMAIL" ] && export GIT_AUTHOR_EMAIL="${nick}@example.com"
+
+message()
+{
+    echo -e "Import $pk3name\n" | cat - "$changes" 2> /dev/null
+}
+
+# Clean up on exit
+
+cleanup_index=
+cleanup_worktree=
+
+cleanup()
+{
+    [ "$cleanup_index" ] && rm -f "$GIT_INDEX_FILE"
+    [ "$cleanup_worktree" ] && find "$GIT_WORK_TREE" -mindepth 1 -delete
+}
+
+trap cleanup EXIT
+
+# Set up index file, makes testing easier
+[ -z "$GIT_INDEX_FILE" ] && {
+    export GIT_INDEX_FILE="$GIT_DIR/pk3-import-index"
+    cleanup_index=t
+}
+
+# Extract the PK3 (the -n suppresses prompting in an edge case)
+unzip -n -qq "$pk3path" -d "$GIT_WORK_TREE" ||
+die "couldn't extract PK3 contents"
+cleanup_worktree=t
+
+# Note the refs and the common ancestor
+master=refs/heads/master
+ref=refs/heads/$branch
+base=$(git merge-base $master $ref 2> /dev/null) ||
+base=$master
+
+# Figure out the parent commit
+parent=\
+$(git rev-parse --verify -q $ref || git rev-parse --verify -q $base) ||
+die "couldn't determine parent commit"
+
+# Read the tree at base into index
+git read-tree $base ||
+die "couldn't initialize index"
+
+# Reject any modified files, the mapper should create a branch instead
+[ -z "$(git diff-files --diff-filter=M)" ] ||
+die "found changes to files in master"
+
+# Force reading of .gitignore files from cache, not the work tree
+git ls-files --cached -z |
+grep -z '\.gitignore$' |
+git update-index --skip-worktree -z --stdin ||
+die "couldn't set up exclude patterns from index"
+
+# Add untracked files; to filter out generated files such as BSP, add
+# them to .gitignore and push, --exclude-standard (and the above hack)
+# takes care of the rest
+git ls-files --exclude-standard -o -z |
+git update-index --add -z --stdin ||
+die "couldn't add files to index"
+
+# Check if the index contains changes against parent
+git diff-index --cached --quiet $parent &&
+die "found no changes to commit"
+
+# Commit the index and point the ref to the new commit
+tree=$(git write-tree) &&
+commit=$(message | git commit-tree $tree -p $parent) &&
+git update-ref -m "pk3-import: $pk3name" $ref $commit ||
+die "couldn't commit changes"
diff --git a/misc/tools/git-pk3-merge b/misc/tools/git-pk3-merge
new file mode 100755 (executable)
index 0000000..69e8298
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+# git-pk3-merge: Attempt a trivial merge of master in a bare repo.
+
+set -x
+
+# Helpers
+
+die()
+{
+    echo "$(basename "$0"): error: $*" >&2
+    exit 1
+}
+
+usage()
+{
+    cat <<EOF
+Usage:
+
+  # mandatory
+  export GIT_DIR=/path/to/xonotic-maps.pk3dir.git # absolute path
+  # optional
+  export GIT_AUTHOR_NAME="Some Guy"
+  export GIT_AUTHOR_EMAIL="someguy@example.com"
+
+  $(basename $0) nick branch
+
+EOF
+}
+
+# Check usage
+
+[ $# -eq 2 ] || {
+    usage
+    die "wrong number of arguments"
+}
+
+[ -z "$GIT_DIR" ] && {
+    usage
+    die "GIT_DIR not set"
+}
+
+nick="$1"
+branch=$(git check-ref-format --print "$nick/$2") ||
+die "malformed branch name '$nick/$2'"
+
+# Set up commit info
+
+[ -z "$GIT_AUTHOR_NAME" ] && export GIT_AUTHOR_NAME="$nick"
+[ -z "$GIT_AUTHOR_EMAIL" ] && export GIT_AUTHOR_EMAIL="${nick}@example.com"
+
+message()
+{
+    echo "Merge branch 'master'"
+}
+
+# Clean up on exit
+
+cleanup_index=
+
+cleanup()
+{
+    [ "$cleanup_index" ] && rm -f "$GIT_INDEX_FILE"
+}
+
+trap cleanup EXIT
+
+# Set up index file, makes testing easier
+[ -z "$GIT_INDEX_FILE" ] && {
+    export GIT_INDEX_FILE="$GIT_DIR/pk3-merge-index"
+    cleanup_index=t
+}
+
+# Note the refs and the common ancestor
+master=refs/heads/master
+ref=refs/heads/$branch
+base=$(git merge-base $master $ref 2> /dev/null) ||
+die "couldn't determine the common ancestor"
+
+# Figure out the parent commits
+parent1=$(git rev-parse --verify -q $ref) &&
+parent2=$(git rev-parse --verify -q $master) ||
+die "couldn't determine parent commits"
+
+# Attempt a trivial merge
+git read-tree -i -m --aggressive --trivial $base $ref $master ||
+die "couldn't do a trivial merge"
+
+# Check if the index contains changes against parent
+git diff-index --cached --quiet $parent1 &&
+die "found no changes to commit"
+
+# Commit the index and point the ref to the new commit
+tree=$(git write-tree) &&
+commit=$(message | git commit-tree $tree -p $parent1 -p $parent2) &&
+git update-ref -m "pk3-merge" $ref $commit ||
+die "couldn't commit merge"
diff --git a/misc/tools/normalmap.sh b/misc/tools/normalmap.sh
new file mode 100755 (executable)
index 0000000..08ca0fa
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# usage: ./bump2norm.sh foo_bump.tga foo_norm.tga
+# NOTE: unfortunately requires X-server (otherwise file-tga-save won't work... no joke)
+
+in=$1
+out=$2
+
+# env variables you can set:
+# filter:
+#   Filter type (0 = 4 sample, 1 = sobel 3x3, 2 = sobel 5x5, 3 = prewitt 3x3, 4 = prewitt 5x5, 5-8 = 3x3,5x5,7x7,9x9)
+# minz:
+#   Minimun Z (0 to 1)
+# scale:
+#   Scale (>0)
+# heightsource:
+#   Height source (0 = average RGB, 1 = alpha channel)
+# conv:
+#   Conversion (0 = none, 1 = Biased RGB, 2 = Red, 3 = Green, 4 = Blue, 5 = Max RGB, 6 = Min RGB, 7 = Colorspace)
+: ${filter:=0}
+: ${minz:=0}
+: ${scale:=1}
+: ${heightsource:=0}
+: ${conv:=0}
+
+gimp -i -b - <<EOF
+
+(let*(
+               (img (car (gimp-file-load RUN-NONINTERACTIVE "$in" "$in")))
+               (drawable (car (gimp-image-active-drawable img)))
+               (layer (car (gimp-image-get-active-layer img)))
+       )
+       (gimp-layer-add-alpha layer)
+       (plug-in-normalmap RUN-NONINTERACTIVE img drawable $filter $minz $scale 1 $heightsource 1 $conv 0 0 1 0 1 layer)
+       (file-tga-save RUN-NONINTERACTIVE img drawable "$out" "$out" 1 1)
+       (gimp-quit 0)
+)
+
+EOF
diff --git a/misc/tools/update-nexcompat.sh b/misc/tools/update-nexcompat.sh
new file mode 100755 (executable)
index 0000000..0fa7816
--- /dev/null
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+set -e
+
+d0="$PWD"
+NEXLOC=$1
+XONLOC=$2
+COMPATLOC=$3
+
+rewrite()
+{
+       case "$1" in
+               scripts/*.shader) echo "scripts/nexcompat-${1#scripts/}" ;;
+               *) echo "$1" ;;
+       esac
+}
+
+unrewrite()
+{
+       case "$1" in
+               scripts/nexcompat-*.shader) echo "scripts/${1#scripts/nexcompat-}" ;;
+               *) echo "$1" ;;
+       esac
+}
+
+wantfile()
+{
+       case "$1" in
+               *.ase) return 1 ;;
+               *.blend) return 1 ;;
+               *.cfg) return 1 ;;
+               demos/*) return 1 ;;
+               font-*.pk3dir/*) return 1 ;;
+               gfx/*) return 1 ;;
+               *.map) return 1 ;;
+               maps/*) return 1 ;;
+               models/player/*) return 1 ;;
+               models/weapons/*) return 1 ;;
+               *.modinfo) return 1 ;;
+               *.pk3) return 1 ;;
+               qcsrc/*) return 1 ;;
+               *.sh) return 1 ;;
+               sound/*) return 1 ;;
+               textures/carni*) return 1 ;;
+               textures/fb*) return 1 ;;
+               textures/fricka*) return 1 ;;
+               textures/grunt*) return 1 ;;
+               textures/headhunter*) return 1 ;;
+               textures/heroine*) return 1 ;;
+               textures/insurrectionist*) return 1 ;;
+               textures/lurk*) return 1 ;;
+               textures/lycanthrope*) return 1 ;;
+               textures/marine*) return 1 ;;
+               textures/mulder*) return 1 ;;
+               textures/nexgun*) return 1 ;;
+               textures/nexus*) return 1 ;;
+               textures/quark*) return 1 ;;
+               textures/shock*) return 1 ;;
+               textures/skadi*) return 1 ;;
+               textures/specop*) return 1 ;;
+               textures/uzi*) return 1 ;;
+               textures/xolar*) return 1 ;;
+               *.txt) return 1 ;;
+       esac
+       if ! [ -f "$NEXLOC/$1" ]; then
+               return 1
+       fi
+       R=`rewrite "$1"`
+       for f in "$XONLOC"/*/"$R" "$XONLOC"/*/"$1"; do
+               case "$f" in
+                       "$XONLOC"/\*/"$R") continue ;;
+                       "$XONLOC"/xonotic-nexcompat.pk3dir/"$R") continue ;;
+                       "$XONLOC"/\*/"$1") continue ;;
+                       "$XONLOC"/xonotic-nexcompat.pk3dir/"$1") continue ;;
+               esac
+               return 1
+       done
+       return 0
+}
+
+cd "$d0"
+cd "$COMPATLOC"
+
+# 1. clear deleted files from the compat pack
+git reset --hard
+git clean -xdf
+git ls-files | while IFS= read -r L; do
+       case "$L" in
+               .gitattributes) continue ;;
+       esac
+       if ! wantfile "`unrewrite "$L"`"; then
+               echo "D $L"
+               git rm -f "$L"
+       fi
+done
+
+CR="\r"
+LF="
+"
+KILL="\e[K"
+UP="\e[A"
+
+# 2. add new files to the compat pack
+echo "* -crlf" > .gitattributes
+git add .gitattributes
+find "$NEXLOC" -type f | while IFS= read -r L; do
+       L0=${L#$NEXLOC/}
+       echo "$UP$L0$KILL" >&2
+       LR=`rewrite "$L0"`
+       if wantfile "$L0"; then
+               newhash=`cd "$NEXLOC"; git rev-parse ":data/$L0"`
+               if oldhash=`git rev-parse ":$LR" 2>/dev/null`; then
+                       if [ x"$oldhash" != x"$newhash" ]; then
+                               echo "$UP""U $LR$LF"
+                               cp "$L" "$LR"
+                               git add "$LR"
+                       fi
+               else
+                       echo "$UP""A $LR$LF"
+                       mkdir -p "$LR"
+                       rmdir "$LR"
+                       cp "$L" "$LR"
+                       git add "$LR"
+               fi
+       fi
+done
+
+git status
+#git commit
index 8f3f4aa0539ef84828a91b50378b0cd3bee7ecb2..c2d7fe6b8b1e625f4279cd968d9e7e232f912519 100755 (executable)
@@ -173,10 +173,10 @@ case "$1" in
                git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
                        git reset --hard
                        git clean -xfd
-                       git checkout "$HASH"
+                       git checkout -f "$HASH"
                        allmaps buildthemap "$REFNAME" "$HASH" "$url" "$bspoutdir"
                done
-               git checkout master
+               git checkout -f master
                ;;
        download)
                mkdir -p "$bspdir" "$bspdir.old"