FIND ?= find
DIFF ?= diff
SED ?= sed
-
-# optional:
GIT ?= git
+SVN ?= svn
+WGET ?= wget
+MV ?= mv
+UNZIP ?= unzip
STDOUT_TO_DEVNULL ?= >/dev/null
STDERR_TO_DEVNULL ?= 2>/dev/null
CPPFLAGS_ZLIB ?=
LIBS_ZLIB ?= -lz
DEPEND_ON_MAKEFILE ?= yes
+DOWNLOAD_GAMEPACKS ?= yes # set to no to disable gamepack, set to all to even download undistributable gamepacks
DEPENDENCIES_CHECK ?= quiet
# or: off, verbose
checkbinary coreutils "$(CP_R)"; \
checkbinary coreutils "$(RM)"; \
checkbinary coreutils "$(RM_R)"; \
+ checkbinary coreutils "$(MV)"; \
checkbinary coreutils "$(ECHO) test $(TEE_STDERR)"; \
checkbinary sed "$(SED)"; \
checkbinary findutils "$(FIND)"; \
checkbinary binutils "$(RANLIB)"; \
checkbinary binutils "$(AR)"; \
checkbinary pkg-config "$(PKGCONFIG)"; \
+ checkbinary unzip "$(UNZIP)"; \
+ checkbinary git-core "$(GIT)"; \
+ checkbinary subversion "$(SVN)"; \
+ checkbinary wget "$(WGET)"; \
[ "$(OS)" = "Win32" ] && checkbinary mingw32 "$(WINDRES)"; \
[ -n "$(LDD)" ] && checkbinary libc6 "$(LDD)"; \
[ -n "$(OTOOL)" ] && checkbinary xcode "$(OTOOL)"; \
$(MKDIR) $(INSTALLDIR)/games
$(FIND) $(INSTALLDIR_BASE)/ -name .svn -exec $(RM_R) {} \; -prune
[ "$(OS)" != "Darwin" ] || $(CP_R) setup/data/osx/NetRadiant.app/* $(INSTALLDIR_BASE)/NetRadiant.app/
- set -ex; \
- for GAME in games/*; do \
- if [ "$$GAME" = "games/*" ]; then \
- $(ECHO) "Game packs not found, please run"; \
- $(ECHO) " ./download-gamepacks.sh"; \
- $(ECHO) "and then try again!"; \
- else \
- CP="$(CP)" CP_R="$(CP_R)" $(SH) install-gamepack.sh "$$GAME" "$(INSTALLDIR)"; \
- fi; \
- done
+ DOWNLOAD_GAMEPACKS="$(DOWNLOAD_GAMEPACKS)" GIT="$(GIT)" SVN="$(SVN)" WGET="$(WGET)" RM_R="$(RM_R)" MV="$(MV)" UNZIP="$(UNZIP)" ECHO="$(ECHO)" SH="$(SH)" CP="$(CP)" CP_R="$(CP_R)" $(SH) install-gamepacks.sh "$(INSTALLDIR)"
$(ECHO) $(RADIANT_MINOR_VERSION) > $(INSTALLDIR)/RADIANT_MINOR
$(ECHO) $(RADIANT_MAJOR_VERSION) > $(INSTALLDIR)/RADIANT_MAJOR
$(CP_R) setup/data/tools/* $(INSTALLDIR)/
# sh download-gamepack.sh
# LICENSEFILTER=GPL BATCH=1 sh download-gamepack.sh
+: ${GIT:=git}
+: ${SVN:=svn}
+: ${WGET:=wget}
+: ${ECHO:=echo}
+: ${MKDIR:=mkdir}
+: ${RM_R:=rm -r}
+: ${MV:=mv}
+: ${UNZIP:=unzip}
+
set -e
extra_urls()
{
if [ -f "$1/extra-urls.txt" ]; then
while IFS=" " read -r FILE URL; do
- wget -O "$1/$FILE" "$URL"
+ $WGET -O "$1/$FILE" "$URL"
done < "$1/extra-urls.txt"
fi
}
source=$1; shift
if [ -d "games/$pack" ]; then
- echo "Updating $pack..."
+ $ECHO "Updating $pack..."
case "$sourcetype" in
svn)
- svn update "games/$pack" "$@"
+ $SVN update "games/$pack" "$@"
;;
zip1)
- rm -rf zipdownload
- mkdir zipdownload
+ $RM_R zipdownload
+ $MKDIR zipdownload
cd zipdownload
- wget "$source" "$@"
- unzip *
+ $WGET "$source" "$@"
+ $UNZIP *
cd ..
- rm -rf "games/$pack"
- mkdir "games/$pack"
- mv zipdownload/*/* "games/$pack/"
- rm -rf zipdownload
+ $RM_R "games/$pack"
+ $MKDIR "games/$pack"
+ $MV zipdownload/*/* "games/$pack/"
+ $RM_R zipdownload
;;
gitdir)
- rm -rf "games/$pack"
+ $RM_R "games/$pack"
cd games
- git archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf -
+ $GIT archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf -
cd ..
;;
git)
cd "games/$pack"
- git pull
+ $GIT pull
cd ../..
;;
esac
return
fi
- echo
- echo "Available pack: $pack"
- echo " License: $license"
- echo " Download via $sourcetype from $source"
- echo
+ $ECHO
+ $ECHO "Available pack: $pack"
+ $ECHO " License: $license"
+ $ECHO " Download via $sourcetype from $source"
+ $ECHO
case " $PACKFILTER " in
" ")
;;
*" $pack "*)
;;
*)
- echo "Pack $pack rejected because it is not in PACKFILTER."
+ $ECHO "Pack $pack rejected because it is not in PACKFILTER."
return
;;
esac
*" $license "*)
;;
*)
- echo "Pack $pack rejected because its license is not in LICENSEFILTER."
+ $ECHO "Pack $pack rejected because its license is not in LICENSEFILTER."
return
;;
esac
case "$BATCH" in
'')
while :; do
- echo "Download this pack? (y/n)"
+ $ECHO "Download this pack? (y/n)"
read -r P
case "$P" in
y*)
;;
esac
- echo "Downloading $pack..."
+ $ECHO "Downloading $pack..."
case "$sourcetype" in
svn)
- svn checkout "$source" "games/$pack" "$@"
+ $SVN checkout "$source" "games/$pack" "$@"
;;
zip1)
- rm -rf zipdownload
- mkdir zipdownload
+ $RM_R zipdownload
+ $MKDIR zipdownload
cd zipdownload
- wget "$source" "$@"
- unzip *
+ $WGET "$source" "$@"
+ $UNZIP *
cd ..
- mkdir "games/$pack"
- mv zipdownload/*/* "games/$pack/"
- rm -rf zipdownload
+ $MKDIR "games/$pack"
+ $MV zipdownload/*/* "games/$pack/"
+ $RM_R zipdownload
;;
gitdir)
cd games
- git archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf -
+ $GIT archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf -
cd ..
;;
git)
cd games
- git clone "$source" "$pack"
+ $GIT clone "$source" "$pack"
cd ..
;;
esac
--- /dev/null
+#!/bin/sh
+
+: ${ECHO:=echo}
+: ${SH:=sh}
+: ${CP:=cp}
+: ${CP_R:=cp -r}
+
+dest=$1
+
+case "$DOWNLOAD_GAMEPACKS" in
+ yes)
+ LICENSEFILTER=GPL BATCH=1 $SH download-gamepacks.sh
+ ;;
+ all)
+ BATCH=1 $SH download-gamepacks.sh
+ ;;
+ *)
+ ;;
+esac
+
+set -e
+for GAME in games/*; do
+ if [ "$GAME" = "games/*" ]; then
+ $ECHO "Game packs not found, please run"
+ $ECHO " ./download-gamepacks.sh"
+ $ECHO "and then try again!"
+ else
+ $SH install-gamepack.sh "$GAME" "$dest"
+ fi
+done