Fix asset installation on *nix

Built-in assets are now installed as paks instead of "loose" files.

There was a bug which caused some files to be not installed properly.
It's now addressed by this commit. (Fixes #430)

It should be now possible to launch OpenSpades without `make install`.
Just make sure to cd to the build directory (where you ran `cmake`) before
launching OpenSpades by `bin/openspades`.
This commit is contained in:
Tomoaki Kawada 2016-11-10 20:37:01 +09:00
parent e9a57d0545
commit 2872e4e66e
4 changed files with 40 additions and 45 deletions

View File

@ -206,19 +206,17 @@ if(UNIX AND NOT APPLE)
# copyright file
INSTALL(FILES ${CMAKE_BINARY_DIR}/Resources/Unix/Debian/copyright DESTINATION ${OPENSPADES_INSTALL_DOC}/)
# install devpak
install(
DIRECTORY ${CMAKE_BINARY_DIR}/Resources/DevPak/
# install asset paks (including non-GPL one)
install(FILES
${CMAKE_BINARY_DIR}/Resources/pak000-Nonfree.pak
${CMAKE_BINARY_DIR}/Resources/pak002-Base.pak
${CMAKE_BINARY_DIR}/Resources/pak005-Models.pak
${CMAKE_BINARY_DIR}/Resources/pak010-BaseSkin.pak
${CMAKE_BINARY_DIR}/Resources/pak050-Locales.pak
${CMAKE_BINARY_DIR}/Resources/pak999-References.pak
DESTINATION ${OPENSPADES_INSTALL_RESOURCES})
# install other resources, that not packed to devpak
install(DIRECTORY Resources/Gfx DESTINATION ${OPENSPADES_INSTALL_RESOURCES})
install(DIRECTORY Resources/Locales DESTINATION ${OPENSPADES_INSTALL_RESOURCES})
install(DIRECTORY Resources/Maps DESTINATION ${OPENSPADES_INSTALL_RESOURCES})
install(DIRECTORY Resources/Scripts DESTINATION ${OPENSPADES_INSTALL_RESOURCES})
install(DIRECTORY Resources/Shaders DESTINATION ${OPENSPADES_INSTALL_RESOURCES})
# install icons
INSTALL(
DIRECTORY ${CMAKE_BINARY_DIR}/Resources/Icons/hicolor/

View File

@ -1,32 +1,17 @@
# this functionality now provided by install code in ../CMakeLists.txt
#
# if(RESDIR_DEFINED)
# add_custom_target(copy_resources ALL COMMENT "Copying resources")
# install(FILES
# ${RESDIR}/pak000-Base.pak
# ${RESDIR}/pak001-Sounds.pak
# ${RESDIR}/pak002-Models.pak
# ${RESDIR}/pak010-BaseSkin.pak
# ${RESDIR}/pak999-References.pak
# DESTINATION share/games/openspades/Resources)
#
# file(GLOB_RECURSE RESOURCES Shaders/* Scripts/* Icons/* Killfeed/*)
# foreach(FILE ${RESOURCES})
# string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR} ${RESDIR} TARGETFILE ${FILE})
# get_filename_component(TARGETDIR ${TARGETFILE} PATH)
# add_custom_command(TARGET copy_resources COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGETDIR}")
# add_custom_command(TARGET copy_resources COMMAND ${CMAKE_COMMAND} -E copy_if_different "${FILE}" "${TARGETFILE}")
# endforeach()
# endif()
if(OPENSPADES_RESOURCES)
add_custom_target(OpenSpades_Resources ALL COMMENT "Downloading external resources")
add_custom_target(OpenSpades_Resources_DevPaks ALL COMMENT "Downloading non-GPL assets")
add_custom_command(
TARGET OpenSpades_Resources_DevPaks
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/downloadpak.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(OpenSpades_Resources ALL COMMENT "Packing assets")
add_custom_command(
TARGET OpenSpades_Resources
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/downloadpak.sh ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mkpak.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

View File

@ -14,7 +14,7 @@ SRC_DIR="`dirname "$0"`"
PAK_URL=$(grep --max-count=1 --no-filename --context=0 --color=never \
"DevPaks" "$SRC_DIR/PakLocation.txt")
PAK_NAME=$(basename "$PAK_URL")
OUTPUT_DIR="DevPak"
OUTPUT_DIR="."
if [ -f "$PAK_NAME" ]; then
exit 0

View File

@ -2,24 +2,36 @@
# This script updates GPL part of official .paks to match the latest git version.
rm -f pak002-Base.pak pak005-Models.pak pak010-BaseSkin.pak pak050-Locales.pak pak999-References.pak
OUTPUT_DIR="`pwd`"
SRC_DIR="`dirname "$0"`"
LOG_FILE="/dev/null"
if [ ! "$MKPAK_LOG_FILE" == "" ]; then
LOG_FILE="$MKPAK_LOG_FILE"
fi
pushd "$SRC_DIR"
EXCLUDELIST=/tmp/mkpak.exclude.txt
find . | grep _Assets_ > $EXCLUDELIST
file . | grep ".DS_Store" >> $EXCLUDELIST
ZIPARGS=-x@${EXCLUDELIST}
rm -f pak002-Base.pak pak005-Models.pak pak010-BaseSkin.pak pak050-Locales.pak pak999-References.pak
zip -r pak002-Base.pak \
zip -r "$OUTPUT_DIR/pak002-Base.pak" \
License/Credits-pak002-Base.md Gfx Scripts/Main.as \
Scripts/Gui Scripts/Base Shaders \
Sounds/Feedback Sounds/Misc Sounds/Player Textures $ZIPARGS
Sounds/Feedback Sounds/Misc Sounds/Player Textures $ZIPARGS > "$LOG_FILE"
zip -r pak005-Models.pak Maps $ZIPARGS
zip -r "$OUTPUT_DIR/pak005-Models.pak" Maps $ZIPARGS > "$LOG_FILE"
zip -r pak010-BaseSkin.pak \
zip -r "$OUTPUT_DIR/pak010-BaseSkin."pak \
License/Credits-pak010-BaseSkin.md \
Scripts/Skin Sounds/Weapons $ZIPARGS
Scripts/Skin Sounds/Weapons $ZIPARGS > "$LOG_FILE"
zip -r pak050-Locales.pak License/Credits-pak050-Locales.md Locales $ZIPARGS
zip -r "$OUTPUT_DIR/pak050-Locales.pak" License/Credits-pak050-Locales.md Locales $ZIPARGS > "$LOG_FILE"
zip -r pak999-References.pak License/Credits-pak999-References.md Scripts/Reference $ZIPARGS
zip -r "$OUTPUT_DIR/pak999-References.pak" License/Credits-pak999-References.md Scripts/Reference $ZIPARGS > "$LOG_FILE"
popd