mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-14 17:00:39 +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
53
.travis.yml
53
.travis.yml
|
@ -593,8 +593,10 @@ install:
|
|||
before_script:
|
||||
# OLDPWD is root repo folder
|
||||
- OLDPWD=$PWD
|
||||
- mkdir -p "$OLDPWD/assets/installer"
|
||||
- cd "$HOME/srb2_cache"
|
||||
|
||||
# Get stat command so we know what the cached archive date is.
|
||||
# stat is different for OSX
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
STATCMD="stat -f %m";
|
||||
|
@ -608,52 +610,25 @@ before_script:
|
|||
echo "$(basename $ASSET_ARCHIVE_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_PATH))";
|
||||
fi;
|
||||
wget --verbose --server-response -N "$ASSET_ARCHIVE_PATH";
|
||||
7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$HOME/srb2_cache" -aos;
|
||||
for f in $ASSET_FILES_REQUIRED; do
|
||||
cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f";
|
||||
done;
|
||||
7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$OLDPWD/assets/installer" -aos;
|
||||
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
|
||||
- if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]]; then
|
||||
for f in $ASSET_FILES_OPTIONAL; 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;
|
||||
- if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]] && [[ "$ASSET_ARCHIVE_OPTIONAL_PATH" != "" ]]; then
|
||||
if [ -f "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" ]; then
|
||||
echo "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_OPTIONAL_PATH))";
|
||||
fi;
|
||||
wget --verbose --server-response -N "$ASSET_ARCHIVE_OPTIONAL_PATH";
|
||||
7z x "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" -o"$OLDPWD/assets/installer" -aos;
|
||||
fi;
|
||||
|
||||
# Go back to root repo folder
|
||||
# Copy assets to repo staging folder, then go back to root repo folder
|
||||
- cd "$OLDPWD"
|
||||
|
||||
# Prepare CMake asset lists
|
||||
- SRB2_ASSET_REQUIRED=$(echo ${ASSET_FILES_REQUIRED// /\;})
|
||||
- SRB2_ASSET_OPTIONAL=$(echo ${ASSET_FILES_OPTIONAL// /\;})
|
||||
- SRB2_ASSET_HASHED=$(echo ${ASSET_FILES_HASHED// /\;})
|
||||
- SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;})
|
||||
- SRB2_ASSET_DIRECTORY="$OLDPWD/assets/installer"
|
||||
|
||||
# Prepare CMake
|
||||
- mkdir build
|
||||
|
@ -662,8 +637,8 @@ before_script:
|
|||
- export CFLAGS="-Wall -W -Werror $WFLAGS"
|
||||
- export CCACHE_COMPRESS=true
|
||||
- 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_DOCS="${SRB2_ASSET_DOCS}"
|
||||
-DSRB2_ASSET_HASHED="${SRB2_ASSET_HASHED}" -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}"
|
||||
-DSRB2_ASSET_DIRECTORY="${SRB2_ASSET_DIRECTORY}"
|
||||
-DCPACK_PACKAGE_DESCRIPTION_SUMMARY="${PROGRAM_NAME}"
|
||||
-DCPACK_PACKAGE_VENDOR="${PROGRAM_VENDOR}"
|
||||
-DSRB2_SDL2_EXE_NAME="${PROGRAM_FILENAME}"
|
||||
|
|
|
@ -9,38 +9,29 @@ FUNCTION(PREPEND var prefix)
|
|||
SET(${var} "${listVar}" PARENT_SCOPE)
|
||||
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;\
|
||||
player.dta;\
|
||||
rings.dta;\
|
||||
zones.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
|
||||
"README.txt;\
|
||||
LICENSE.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
|
||||
"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})
|
||||
PREPEND(SRB2_ASSET_DOCS ${SRB2_ASSET_DIRECTORY} ${SRB2_ASSET_DOCS})
|
||||
|
||||
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)
|
||||
endforeach()
|
||||
|
||||
|
@ -48,27 +39,20 @@ endforeach()
|
|||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
||||
install(FILES ${SRB2_ASSET_REQUIRED}
|
||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||
DESTINATION "${outname}.app/Contents/Resources"
|
||||
)
|
||||
install(FILES ${SRB2_ASSET_OPTIONAL}
|
||||
DESTINATION "${outname}.app/Contents/Resources"
|
||||
OPTIONAL
|
||||
)
|
||||
install(FILES ${SRB2_ASSET_DOCS}
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
else()
|
||||
install(FILES ${SRB2_ASSET_REQUIRED}
|
||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||
DESTINATION .
|
||||
)
|
||||
install(FILES ${SRB2_ASSET_OPTIONAL}
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
install(FILES ${SRB2_ASSET_DOCS}
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again
|
||||
#install(FILES ${SRB2_ASSET_DOCS}
|
||||
# DESTINATION .
|
||||
# OPTIONAL
|
||||
#)
|
||||
endif()
|
||||
|
|
|
@ -47,55 +47,31 @@ RM := rm -rf
|
|||
DIR := $(shell pwd)
|
||||
|
||||
PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g')
|
||||
DATAFILES := ${ASSET_FILES_REQUIRED}
|
||||
DOCFILES := ${ASSET_FILES_DOCS}
|
||||
OPTIONALFILES := ${ASSET_FILES_OPTIONAL}
|
||||
ARCHIVEPATH := ${ASSET_ARCHIVE_PATH}
|
||||
ARCHIVEOPTIONALPATH := ${ASSET_ARCHIVE_OPTIONAL_PATH}
|
||||
GETOPTIONALFILES := ${ASSET_FILES_OPTIONAL_GET}
|
||||
|
||||
DATADIR := $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///')
|
||||
RESOURCEDIR := .
|
||||
STAGINGDIR := $(RESOURCEDIR)/installer
|
||||
WGET := wget -P $(RESOURCEDIR) -c -nc
|
||||
|
||||
build:
|
||||
$(MKDIR) $(DIR)/debian/tmp/$(DATADIR)
|
||||
> $(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
|
||||
for file in $(DATAFILES); do \
|
||||
if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \
|
||||
$(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \
|
||||
if [ ! -d $(STAGINGDIR) ]; then \
|
||||
mkdir -p "$(STAGINGDIR)"; \
|
||||
$(WGET) $(ARCHIVEPATH); \
|
||||
7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEPATH))" -aos; \
|
||||
if [ "$(GETOPTIONALFILES)" = "1" ]; then \
|
||||
$(WGET) $(ARCHIVEOPTIONALPATH); \
|
||||
7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEOPTIONALPATH))" -aos; \
|
||||
fi; \
|
||||
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 \
|
||||
for file in $(OPTIONALFILES); 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; \
|
||||
fi;
|
||||
fi
|
||||
# Install asset directory and add asset file to include-binaries
|
||||
cp -vr "$(STAGINGDIR)/." "$(DIR)/debian/tmp/$(DATADIR)"
|
||||
find "$(STAGINGDIR)" >> $(DIR)/debian/source/include-binaries
|
||||
|
||||
|
||||
binary-indep:
|
||||
|
|
|
@ -28,10 +28,9 @@
|
|||
|
||||
# Asset File Parameters
|
||||
: ${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_FILES_REQUIRED:=srb2.srb zones.dta player.dta rings.dta patch.dta}
|
||||
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z}
|
||||
: ${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_OPTIONAL:=music.dta}
|
||||
: ${ASSET_FILES_OPTIONAL_GET:=0}
|
||||
|
||||
# FTP Parameters
|
||||
|
@ -78,10 +77,9 @@
|
|||
# Export Asset and Package Parameters for envsubst templating
|
||||
|
||||
export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}"
|
||||
export ASSET_BASE_PATH="${ASSET_BASE_PATH}"
|
||||
export ASSET_FILES_REQUIRED="${ASSET_FILES_REQUIRED}"
|
||||
export ASSET_ARCHIVE_OPTIONAL_PATH="${ASSET_ARCHIVE_OPTIONAL_PATH}"
|
||||
export ASSET_FILES_HASHED="${ASSET_FILES_HASHED}"
|
||||
export ASSET_FILES_DOCS="${ASSET_FILES_DOCS}"
|
||||
export ASSET_FILES_OPTIONAL="${ASSET_FILES_OPTIONAL}"
|
||||
export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}"
|
||||
|
||||
export PACKAGE_NAME="${PACKAGE_NAME}"
|
||||
|
|
Loading…
Reference in a new issue