mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Don't download individual asset files; support only archives
This commit is contained in:
parent
78fa72514f
commit
4d4b048ead
4 changed files with 47 additions and 114 deletions
51
.travis.yml
51
.travis.yml
|
@ -593,8 +593,10 @@ install:
|
||||||
before_script:
|
before_script:
|
||||||
# OLDPWD is root repo folder
|
# OLDPWD is root repo folder
|
||||||
- OLDPWD=$PWD
|
- OLDPWD=$PWD
|
||||||
|
- mkdir -p "$OLDPWD/assets/installer"
|
||||||
- cd "$HOME/srb2_cache"
|
- cd "$HOME/srb2_cache"
|
||||||
|
|
||||||
|
# Get stat command so we know what the cached archive date is.
|
||||||
# stat is different for OSX
|
# stat is different for OSX
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||||
STATCMD="stat -f %m";
|
STATCMD="stat -f %m";
|
||||||
|
@ -608,52 +610,25 @@ before_script:
|
||||||
echo "$(basename $ASSET_ARCHIVE_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_PATH))";
|
echo "$(basename $ASSET_ARCHIVE_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_PATH))";
|
||||||
fi;
|
fi;
|
||||||
wget --verbose --server-response -N "$ASSET_ARCHIVE_PATH";
|
wget --verbose --server-response -N "$ASSET_ARCHIVE_PATH";
|
||||||
7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$HOME/srb2_cache" -aos;
|
7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$OLDPWD/assets/installer" -aos;
|
||||||
for f in $ASSET_FILES_REQUIRED; do
|
|
||||||
cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f";
|
|
||||||
done;
|
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# Get individual required files
|
|
||||||
- for f in $ASSET_FILES_REQUIRED; do
|
|
||||||
if [ -f "$f" ]; then
|
|
||||||
echo "$f cache date -- $($STATCMD $f)";
|
|
||||||
fi;
|
|
||||||
wget --verbose --server-response -N "$ASSET_BASE_PATH/$f";
|
|
||||||
if [ ! -f "$HOME/srb2_cache/$f" ]; then
|
|
||||||
echo "Could not download \"$ASSET_BASE_PATH/$f\"";
|
|
||||||
return 1;
|
|
||||||
fi;
|
|
||||||
cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f";
|
|
||||||
done;
|
|
||||||
|
|
||||||
# Get the docs
|
|
||||||
- for f in $ASSET_FILES_DOCS; do
|
|
||||||
if [ -f "$f" ]; then
|
|
||||||
echo "$f cache date -- $($STATCMD $f)";
|
|
||||||
fi;
|
|
||||||
wget --verbose --server-response -N "$ASSET_BASE_PATH/$f";
|
|
||||||
cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f";
|
|
||||||
done;
|
|
||||||
|
|
||||||
# Get optional files too
|
# Get optional files too
|
||||||
- if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]]; then
|
- if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]] && [[ "$ASSET_ARCHIVE_OPTIONAL_PATH" != "" ]]; then
|
||||||
for f in $ASSET_FILES_OPTIONAL; do
|
if [ -f "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" ]; then
|
||||||
if [ -f "$f" ]; then
|
echo "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_OPTIONAL_PATH))";
|
||||||
echo "$f cache date -- $($STATCMD $f)";
|
|
||||||
fi;
|
fi;
|
||||||
wget --verbose --server-response -N "$ASSET_BASE_PATH/$f";
|
wget --verbose --server-response -N "$ASSET_ARCHIVE_OPTIONAL_PATH";
|
||||||
cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f";
|
7z x "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" -o"$OLDPWD/assets/installer" -aos;
|
||||||
done;
|
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# Go back to root repo folder
|
# Copy assets to repo staging folder, then go back to root repo folder
|
||||||
- cd "$OLDPWD"
|
- cd "$OLDPWD"
|
||||||
|
|
||||||
# Prepare CMake asset lists
|
# Prepare CMake asset lists
|
||||||
- SRB2_ASSET_REQUIRED=$(echo ${ASSET_FILES_REQUIRED// /\;})
|
- SRB2_ASSET_HASHED=$(echo ${ASSET_FILES_HASHED// /\;})
|
||||||
- SRB2_ASSET_OPTIONAL=$(echo ${ASSET_FILES_OPTIONAL// /\;})
|
|
||||||
- SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;})
|
- SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;})
|
||||||
|
- SRB2_ASSET_DIRECTORY="$OLDPWD/assets/installer"
|
||||||
|
|
||||||
# Prepare CMake
|
# Prepare CMake
|
||||||
- mkdir build
|
- mkdir build
|
||||||
|
@ -662,8 +637,8 @@ before_script:
|
||||||
- export CFLAGS="-Wall -W -Werror $WFLAGS"
|
- export CFLAGS="-Wall -W -Werror $WFLAGS"
|
||||||
- export CCACHE_COMPRESS=true
|
- export CCACHE_COMPRESS=true
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package
|
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package
|
||||||
-DSRB2_ASSET_REQUIRED="${SRB2_ASSET_REQUIRED}" -DSRB2_ASSET_OPTIONAL="${SRB2_ASSET_OPTIONAL}"
|
-DSRB2_ASSET_HASHED="${SRB2_ASSET_HASHED}" -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}"
|
||||||
-DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}"
|
-DSRB2_ASSET_DIRECTORY="${SRB2_ASSET_DIRECTORY}"
|
||||||
-DCPACK_PACKAGE_DESCRIPTION_SUMMARY="${PROGRAM_NAME}"
|
-DCPACK_PACKAGE_DESCRIPTION_SUMMARY="${PROGRAM_NAME}"
|
||||||
-DCPACK_PACKAGE_VENDOR="${PROGRAM_VENDOR}"
|
-DCPACK_PACKAGE_VENDOR="${PROGRAM_VENDOR}"
|
||||||
-DSRB2_SDL2_EXE_NAME="${PROGRAM_FILENAME}"
|
-DSRB2_SDL2_EXE_NAME="${PROGRAM_FILENAME}"
|
||||||
|
|
|
@ -9,38 +9,29 @@ FUNCTION(PREPEND var prefix)
|
||||||
SET(${var} "${listVar}" PARENT_SCOPE)
|
SET(${var} "${listVar}" PARENT_SCOPE)
|
||||||
ENDFUNCTION(PREPEND)
|
ENDFUNCTION(PREPEND)
|
||||||
|
|
||||||
set(SRB2_ASSET_REQUIRED
|
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
||||||
|
CACHE STRING "Path to directory that contains all asset files for the installer.")
|
||||||
|
|
||||||
|
set(SRB2_ASSET_HASHED
|
||||||
"srb2.srb;\
|
"srb2.srb;\
|
||||||
player.dta;\
|
player.dta;\
|
||||||
rings.dta;\
|
rings.dta;\
|
||||||
zones.dta;\
|
zones.dta;\
|
||||||
patch.dta"
|
patch.dta"
|
||||||
CACHE STRING "Required asset files for packaging. No spaces between entries!"
|
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SRB2_ASSET_DOCS
|
set(SRB2_ASSET_DOCS
|
||||||
"README.txt;\
|
"README.txt;\
|
||||||
LICENSE.txt;\
|
LICENSE.txt;\
|
||||||
LICENSE-3RD-PARTY.txt"
|
LICENSE-3RD-PARTY.txt"
|
||||||
CACHE STRING "Documentation files; will not fail if they do not exist. Packaged differently from optional assets. No spaces between entries!"
|
CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SRB2_ASSET_OPTIONAL
|
PREPEND(SRB2_ASSET_DOCS ${SRB2_ASSET_DIRECTORY} ${SRB2_ASSET_DOCS})
|
||||||
"music.dta"
|
|
||||||
CACHE STRING "Optional asset files. No spaces between entries!"
|
|
||||||
)
|
|
||||||
|
|
||||||
# MD5 generation - Filename only, we don't append path to this
|
|
||||||
set(SRB2_ASSET_HASHED
|
|
||||||
${SRB2_ASSET_REQUIRED}
|
|
||||||
)
|
|
||||||
|
|
||||||
PREPEND(SRB2_ASSET_REQUIRED ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_REQUIRED})
|
|
||||||
PREPEND(SRB2_ASSET_DOCS ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_DOCS})
|
|
||||||
PREPEND(SRB2_ASSET_OPTIONAL ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_OPTIONAL})
|
|
||||||
|
|
||||||
foreach(SRB2_ASSET ${SRB2_ASSET_HASHED})
|
foreach(SRB2_ASSET ${SRB2_ASSET_HASHED})
|
||||||
file(MD5 ${CMAKE_CURRENT_SOURCE_DIR}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH")
|
file(MD5 ${SRB2_ASSET_DIRECTORY}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH")
|
||||||
set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE)
|
set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
@ -48,27 +39,20 @@ endforeach()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||||
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
||||||
install(FILES ${SRB2_ASSET_REQUIRED}
|
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||||
DESTINATION "${outname}.app/Contents/Resources"
|
DESTINATION "${outname}.app/Contents/Resources"
|
||||||
)
|
)
|
||||||
install(FILES ${SRB2_ASSET_OPTIONAL}
|
|
||||||
DESTINATION "${outname}.app/Contents/Resources"
|
|
||||||
OPTIONAL
|
|
||||||
)
|
|
||||||
install(FILES ${SRB2_ASSET_DOCS}
|
install(FILES ${SRB2_ASSET_DOCS}
|
||||||
DESTINATION .
|
DESTINATION .
|
||||||
OPTIONAL
|
OPTIONAL
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install(FILES ${SRB2_ASSET_REQUIRED}
|
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||||
DESTINATION .
|
DESTINATION .
|
||||||
)
|
)
|
||||||
install(FILES ${SRB2_ASSET_OPTIONAL}
|
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again
|
||||||
DESTINATION .
|
#install(FILES ${SRB2_ASSET_DOCS}
|
||||||
OPTIONAL
|
# DESTINATION .
|
||||||
)
|
# OPTIONAL
|
||||||
install(FILES ${SRB2_ASSET_DOCS}
|
#)
|
||||||
DESTINATION .
|
|
||||||
OPTIONAL
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -47,55 +47,31 @@ RM := rm -rf
|
||||||
DIR := $(shell pwd)
|
DIR := $(shell pwd)
|
||||||
|
|
||||||
PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g')
|
PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g')
|
||||||
DATAFILES := ${ASSET_FILES_REQUIRED}
|
ARCHIVEPATH := ${ASSET_ARCHIVE_PATH}
|
||||||
DOCFILES := ${ASSET_FILES_DOCS}
|
ARCHIVEOPTIONALPATH := ${ASSET_ARCHIVE_OPTIONAL_PATH}
|
||||||
OPTIONALFILES := ${ASSET_FILES_OPTIONAL}
|
|
||||||
GETOPTIONALFILES := ${ASSET_FILES_OPTIONAL_GET}
|
GETOPTIONALFILES := ${ASSET_FILES_OPTIONAL_GET}
|
||||||
|
|
||||||
DATADIR := $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///')
|
DATADIR := $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///')
|
||||||
RESOURCEDIR := .
|
RESOURCEDIR := .
|
||||||
|
STAGINGDIR := $(RESOURCEDIR)/installer
|
||||||
WGET := wget -P $(RESOURCEDIR) -c -nc
|
WGET := wget -P $(RESOURCEDIR) -c -nc
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MKDIR) $(DIR)/debian/tmp/$(DATADIR)
|
$(MKDIR) $(DIR)/debian/tmp/$(DATADIR)
|
||||||
> $(DIR)/debian/source/include-binaries
|
> $(DIR)/debian/source/include-binaries
|
||||||
# This will need to be updated every time SRB2 official version is
|
|
||||||
# Copy data files to their install locations, and add data files to include-binaries
|
# Copy data files to their install locations, and add data files to include-binaries
|
||||||
for file in $(DATAFILES); do \
|
if [ ! -d $(STAGINGDIR) ]; then \
|
||||||
if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
mkdir -p "$(STAGINGDIR)"; \
|
||||||
$(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \
|
$(WGET) $(ARCHIVEPATH); \
|
||||||
fi; \
|
7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEPATH))" -aos; \
|
||||||
if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
|
||||||
$(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \
|
|
||||||
echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \
|
|
||||||
fi; \
|
|
||||||
if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR} ]; then \
|
|
||||||
echo $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR} not found and could not be downloaded!; \
|
|
||||||
return 1; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
# Do the same for DOCFILES, but don't error out if not found
|
|
||||||
for file in $(DOCFILES); do \
|
|
||||||
if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
|
||||||
$(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \
|
|
||||||
fi; \
|
|
||||||
if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
|
||||||
$(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \
|
|
||||||
echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
# Do the same for OPTIONALFILES if GETOPTIONALFILES == 1
|
|
||||||
if [ "$(GETOPTIONALFILES)" = "1" ]; then \
|
if [ "$(GETOPTIONALFILES)" = "1" ]; then \
|
||||||
for file in $(OPTIONALFILES); do \
|
$(WGET) $(ARCHIVEOPTIONALPATH); \
|
||||||
if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEOPTIONALPATH))" -aos; \
|
||||||
$(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \
|
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
fi
|
||||||
$(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \
|
# Install asset directory and add asset file to include-binaries
|
||||||
echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \
|
cp -vr "$(STAGINGDIR)/." "$(DIR)/debian/tmp/$(DATADIR)"
|
||||||
fi; \
|
find "$(STAGINGDIR)" >> $(DIR)/debian/source/include-binaries
|
||||||
done; \
|
|
||||||
fi;
|
|
||||||
|
|
||||||
|
|
||||||
binary-indep:
|
binary-indep:
|
||||||
|
|
|
@ -28,10 +28,9 @@
|
||||||
|
|
||||||
# Asset File Parameters
|
# Asset File Parameters
|
||||||
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z}
|
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z}
|
||||||
: ${ASSET_BASE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets}
|
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z}
|
||||||
: ${ASSET_FILES_REQUIRED:=srb2.srb zones.dta player.dta rings.dta patch.dta}
|
: ${ASSET_FILES_HASHED:=srb2.srb zones.dta player.dta rings.dta patch.dta}
|
||||||
: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt}
|
: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt}
|
||||||
: ${ASSET_FILES_OPTIONAL:=music.dta}
|
|
||||||
: ${ASSET_FILES_OPTIONAL_GET:=0}
|
: ${ASSET_FILES_OPTIONAL_GET:=0}
|
||||||
|
|
||||||
# FTP Parameters
|
# FTP Parameters
|
||||||
|
@ -78,10 +77,9 @@
|
||||||
# Export Asset and Package Parameters for envsubst templating
|
# Export Asset and Package Parameters for envsubst templating
|
||||||
|
|
||||||
export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}"
|
export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}"
|
||||||
export ASSET_BASE_PATH="${ASSET_BASE_PATH}"
|
export ASSET_ARCHIVE_OPTIONAL_PATH="${ASSET_ARCHIVE_OPTIONAL_PATH}"
|
||||||
export ASSET_FILES_REQUIRED="${ASSET_FILES_REQUIRED}"
|
export ASSET_FILES_HASHED="${ASSET_FILES_HASHED}"
|
||||||
export ASSET_FILES_DOCS="${ASSET_FILES_DOCS}"
|
export ASSET_FILES_DOCS="${ASSET_FILES_DOCS}"
|
||||||
export ASSET_FILES_OPTIONAL="${ASSET_FILES_OPTIONAL}"
|
|
||||||
export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}"
|
export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}"
|
||||||
|
|
||||||
export PACKAGE_NAME="${PACKAGE_NAME}"
|
export PACKAGE_NAME="${PACKAGE_NAME}"
|
||||||
|
|
Loading…
Reference in a new issue