diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ca0fd81fe --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git/ +.github/ +build/ +packages/ +.gitignore +.travis.yml +*.am +*.pyc +*.log +*.bak diff --git a/.gitignore b/.gitignore index 0d20b6487..5ddb2cdfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.pyc +build/ +packages/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..75d519238 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,106 @@ +# .travis.yml +# +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +language: cpp +os: linux + +services: + - docker + +git: + submodules: false + +dist: focal + +# When updating be sure to add a section +# to the matrix to cover the distro +jobs: + include: + # - os: linux + # name: "Ubuntu 20.04 focal" + # env: + # - FROM='ubuntu:focal' + # - os: linux + # name: "Ubuntu 18.04 bionic" + # env: + # - FROM='ubuntu:bionic' + # - os: linux + # name: "Ubuntu 16.04 xenial" + # env: + # - FROM='ubuntu:xenial' + # - os: linux + # name: "Debian 10 buster" + # env: + # - FROM='debian:buster' + - os: linux + name: "Debian 9 stretch" + env: + - FROM='debian:stretch' + - os: linux + name: "openSUSE Leap 15.2" + env: + - FROM='opensuse/leap' + - os: linux + name: "Fedora 32" + env: + - FROM='fedora:32' + - os: linux + name: "Fedora 31" + env: + - FROM='fedora:31' + - os: linux + name: "Fedora 30" + env: + - FROM='fedora:30' + - os: linux + name: "CentOS 8" + env: + - FROM='centos:8' + # - os: osx + # osx_image: xcode11.3 + # env: + # - FLAGS='-DUSE_PYTHON_3=OFF -DBoost_NO_BOOST_CMAKE=ON' + # - os: osx + # osx_image: xcode11.3 + # env: + # - FLAGS='-DUSE_PYTHON_3=ON' + fast_finish: true + +script: + - script/cibuild + +deploy: + # Use DPL V2 + edge: true + # GitHub Releases + provider: releases + token: $GITHUB_TOKEN + file_glob: true + file: + # Upload files in the `packages` directory + - ./packages/* +# # release is a draft so it can be edited, updated, etc. +# # Not needed as we'll do that manually when we'll begin the release. +# draft: true +# prerelease: true +# # GitHub Releases requires a tag; this guarantees a tag is set + on: + tags: true + repo: vegastrike/Assets-Production diff --git a/CMakeLists.txt b/CMakeLists.txt index 072e9dcdc..cf16d43c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,28 @@ -cmake_minimum_required(VERSION 3.17) -project(Vegastrike) +#==================================== +# @file : CMakeLists.txt +# @brief : cmake configuration file for vsUTCS +#==================================== +# Copyright (C) 2020 Evert Vorster, Stephen G. Tuggy, +# and other vsUTCS contributors. +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) +PROJECT(vsUTCS) INSTALL(DIRECTORY .vegastrike/ DESTINATION share/vegastrike/.vegastrike PATTERN "*.am" EXCLUDE) @@ -13,10 +36,10 @@ INSTALL(DIRECTORY animations/ DESTINATION share/vegastrike/animations INSTALL(DIRECTORY bases/ DESTINATION share/vegastrike/bases PATTERN "*.am" EXCLUDE) -INSTALL(DIRECTORY cgi-accountserver/ DESTINATION share/vegastrike/cgi-accountserver +INSTALL(DIRECTORY cgi-accountserver/ DESTINATION share/vegastrike/cgi-accountserver PATTERN "*.am" EXCLUDE) -INSTALL(DIRECTORY cockpits/ DESTINATION share/vegastrike/cockpits +INSTALL(DIRECTORY cockpits/ DESTINATION share/vegastrike/cockpits PATTERN "*.am" EXCLUDE) INSTALL(DIRECTORY communications/ DESTINATION share/vegastrike/communications @@ -83,7 +106,7 @@ INSTALL(FILES vega-license.txt DESTINATION share/vegastrike) INSTALL(FILES weapon_list.xml DESTINATION share/vegastrike) -#Linux specific locations from here on out. +# Linux specific locations from here on out. INSTALL(FILES vegastrike.config DESTINATION share/vegastrike) @@ -93,13 +116,153 @@ INSTALL(FILES vegastrike.png DESTINATION share/pixmaps) INSTALL(FILES vegastrike.xpm DESTINATION share/pixmaps) -INSTALL(FILES vs DESTINATION bin PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_WRITE GROUP_EXECUTE +INSTALL(FILES vs DESTINATION bin PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) -INSTALL(FILES vsettings DESTINATION bin PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_WRITE GROUP_EXECUTE +INSTALL(FILES vsettings DESTINATION bin PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) +# CPack stuff +SET(CPACK_PACKAGE_NAME "vsUTCS") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "3D space combat and trading game") +SET(CPACK_PACKAGE_VENDOR "Vega Strike") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/documentation/readme.txt") +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/vega-license.txt") +SET(CPACK_PACKAGE_VERSION_MAJOR "0") +SET(CPACK_PACKAGE_VERSION_MINOR "7") +SET(CPACK_PACKAGE_VERSION_PATCH "0") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vsUTCS-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") +SET(CPACK_CONTACT "maintainers@vega-strike.org") +SET(CPACK_SOURCE_IGNORE_FILES "/build/;/packages/;/.git/;.*\.pyc;.*\.am") + +# Source package filename +IF (DEFINED ENV{TRAVIS_TAG}) + SET(vsUTCS_PACKAGE_VERSION_STR "$ENV{TRAVIS_TAG}") +ELSE (DEFINED ENV{TRAVIS_TAG}) + SET(vsUTCS_PACKAGE_VERSION_STR "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +ENDIF (DEFINED ENV{TRAVIS_TAG}) +SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}-Source") +SET(CPACK_SOURCE_GENERATOR "TXZ") + +IF (WIN32 AND NOT UNIX) + MESSAGE("-- Configuring Packaging for Windows") + # NSIS - See https://cmake.org/cmake/help/v3.3/module/CPackNSIS.html + # NSI bug requires at least 1 set of 4 forwards slashes?? + SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\favicon.ico") + SET(CPACK_NSIS_DISPLAY_NAME "Vega Strike Upon the Coldest Sea") + SET(CPACK_NSIS_HELP_LINK "https:\\\\vega-strike.org") + SET(CPACK_NSIS_URL_INFO_ABOUT "https:\\\\vega-strike.org/about") + SET(CPACK_NSIS_CONTACT "maintainers@vega-strike.org") + SET(CPACK_NSIS_MODIFY_PATH ON) + + # NSIS, Wix, and compressed archives (7z, Zip) + SET(CPACK_GENERATOR "NSIS" "NSIS64" "WIX" "7Z" "ZIP") + # SET(CPACK_PACKAGE_EXECUTABLES "vegastrike.exe" "mesh_tool.exe" "vegasettings.exe") +ELSEIF (XCODE) + MESSAGE("-- Configuring Packaging for Mac OS X") + # Mac OS X + # There's a few options for MacOSX; not sure what we want to use + # DragNDrop -> DMG + # See https://cmake.org/cmake/help/v3.3/module/CPackDMG.html + # Bundle -> Compressed Disk Image + # PackageMaker - see https://cmake.org/cmake/help/v3.3/module/CPackPackageMaker.html + SET(CPACK_GENERATOR "DragNDrop" "BUNDLE" "TXZ") +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) + MESSAGE("-- Configuring Packaging for Linux") + SET(CPACK_GENERATOR "TXZ") + + # Gather info about Linux distro and release (if applicable). + IF (CMAKE_SYSTEM_NAME STREQUAL Linux) + EXECUTE_PROCESS( + COMMAND sh -c "cat /etc/os-release | grep ^ID= | sed 's/^ID=//' | tr -d '\"\n'" + OUTPUT_VARIABLE LINUX_ID) + EXECUTE_PROCESS( + COMMAND sh -c "cat /etc/os-release | grep ^VERSION_CODENAME= | sed 's/^VERSION_CODENAME=//' | tr -d '\"\n'" + OUTPUT_VARIABLE LINUX_CODENAME) + EXECUTE_PROCESS( + COMMAND sh -c "cat /etc/os-release | grep ^VERSION_ID= | sed 's/^VERSION_ID=//' | tr -d '\"\n'" + OUTPUT_VARIABLE LINUX_VERSION_ID) + ENDIF (CMAKE_SYSTEM_NAME STREQUAL Linux) + + # SET(LSB_EXISTS FALSE) + # SET(LSB_LINUX_DISTRIBUTION "Unknown") + # SET(LSB_LINUX_DISTRIBUTION_CODENAME "Unknown") + + # # Lookup the LSB Data - this is known for Ubuntu, but also used by other distros too. + # # and may help with distro-sub-selection + # FIND_PROGRAM(LSB_RELEASE_EXEC lsb_release) + # IF (LSB_RELEASE_EXEC) + # EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXEC} --codename --short + # OUTPUT_VARIABLE LSB_LINUX_DISTRIBUTION_CODENAME + # OUTPUT_STRIP_TRAILING_WHITESPACE) + # EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXEC} --id --short + # OUTPUT_VARIABLE LSB_LINUX_DISTRIBUTION + # OUTPUT_STRIP_TRAILING_WHITESPACE) + # SET(LSB_EXISTS TRUE) + # MESSAGE("Found Linux Distribution Release Name: ${LSB_LINUX_DISTRIBUTION_CODENAME}") + # ENDIF (LSB_RELEASE_EXEC) + + # "DEB" + FIND_PROGRAM(HAS_APT NAMES apt-get apt) + IF (HAS_APT) + MESSAGE("-- Configuring Debian Packaging") + # See https://cmake.org/cmake/help/v3.3/module/CPackDeb.html + SET(CPACK_DEBIAN_PACKAGE_NAME "vsUTCS") + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "maintainers@vega-strike.org") + SET(CPACK_DEBIAN_COMPRESSION_TYPE "bzip2") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "vega-strike") + + # Debian Version: /etc/debian_version - / + # IF (NOT LSB_EXISTS) + # SET(USE_DEBIAN_VERSION TRUE) + # FILE(READ "/etc/debian_version" DEBIAN_VERSION_DATA) + # STRING(REGEX MATCH "^(.+)\/.*$" DEBIAN_VERSION_DATA DEBIAN_RELEASE_VERSION) + # ELSE (NOT LSB_EXISTS) + # SET(USE_DEBIAN_VERSION FALSE) + # SET(DEBIAN_RELEASE_VERSION "Debian Derivative Release Version ${LSB_LINUX_DISTRIBUTION_CODENAME}") + # ENDIF (NOT LSB_EXISTS) + + # IF (USE_DEBIAN_VERSION) + # SET(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}-debian-${DEBIAN_RELEASE_VERSION}_x86_64") + # ELSE (USE_DEBIAN_VERSION) + # SET(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}-${LSB_LINUX_DISTRIBUTION}-${LSB_LINUX_DISTRIBUTION_CODENAME}_x86_64") + # ENDIF (USE_DEBIAN_VERSION) + + SET(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}") + + SET(CPACK_DEBIAN_PACKAGE_SECTION "Amusements/Games") + SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.vega-strike.org") + SET(CPACK_GENERATOR "DEB") + ENDIF (HAS_APT) + + # "RPM" + FIND_PROGRAM(HAS_RPMBUILD rpmbuild) + IF (HAS_RPMBUILD) + MESSAGE("-- Configuring RPM Packaging") + # See https://cmake.org/cmake/help/v3.3/module/CPackRPM.html + SET(CPACK_RPM_PACKAGE_LICENSE "GPLv3") # See ../LICENSE + SET(CPACK_RPM_PACKAGE_URL "https://www.vega-strike.org") + SET(CPACK_RPM_PACKAGE_NAME "vsUTCS") + SET(CPACK_RPM_PACKAGE_REQUIRES "Vega-Strike") + + # Figure out the filename + IF (LINUX_CODENAME) + SET(vsUTCS_LINUX_VERSION_STR "${LINUX_CODENAME}") + ELSE (LINUX_CODENAME) + SET(vsUTCS_LINUX_VERSION_STR "${LINUX_VERSION_ID}") + ENDIF (LINUX_CODENAME) + + SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}-${LINUX_ID}-${vsUTCS_LINUX_VERSION_STR}") + SET(CPACK_GENERATOR "RPM") + ENDIF (HAS_RPMBUILD) +ELSE (WIN32 AND NOT UNIX) + MESSAGE("-- Configuring Packaging for Unknown Platforms - \"${CMAKE_SYSTEM_NAME}\"") + # Unknown Platform --> Just do compressed tarball + SET(CPACK_GENERATOR "TXZ") +ENDIF (WIN32 AND NOT UNIX) + +INCLUDE(CPack) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..353c39911 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# Dockerfile +# +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +ARG from +FROM ${from} + +WORKDIR /usr/src/vsUTCS + +COPY . . + +ENTRYPOINT ["script/docker-entrypoint.sh"] diff --git a/script/build b/script/build new file mode 100755 index 000000000..375799a8f --- /dev/null +++ b/script/build @@ -0,0 +1,59 @@ +#!/bin/bash +#==================================== +# @file : build +# @brief : build vsUTCS +# @usage : script/build +# @param : none +#==================================== + +#============ DESCRIPTION =========== +# The steps for creating this script were adapted from: +# https://github.com/Taose/Vegastrike-taose/wiki/How-to-Build +#==================================== + +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +set -e + +echo "--------------------------" +echo "--- build | 2020-08-23 ---" +echo "--------------------------" + +#---------------------------------- +# validate parameters +#---------------------------------- + +ROOT_DIR=$(pwd) +BUILD_DIR=$ROOT_DIR/build +SRC_DIR=$ROOT_DIR +COMMAND="" + +# -p creates if the target doesn't exist, noop otherwise +mkdir -pv $BUILD_DIR && cd $BUILD_DIR + +cmake $@ $SRC_DIR + +# for a clean build only +# mut we can do it manually +#make clean + +# compile now using all cpus and show compilation commands +make -j $(nproc) VERBOSE=1 + +cd $ROOT_DIR diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 000000000..80ce81323 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,44 @@ +#!/bin/bash +#==================================== +# @file : cibuild +# @brief : Builds vsUTCS for purposes of CI/CD (Travis) +# @usage : script/cibuild +# @param : none +#==================================== +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +set -e + +if [ "$TRAVIS_OS_NAME" == "linux" ] +then + SRC_DOCKER_IMG_NAME="vegastrike/vega-strike-build-env:$(echo $FROM | sed 's/:/_/' | sed 's/\//_/')" + DST_DOCKER_IMG_NAME="building-vsutcs:$(echo $FROM | sed 's/:/_/' | sed 's/\//_/')" + DOCKER_CONTAINER_NAME="building-vsutcs_$(echo $FROM | sed 's/:/_/' | sed 's/\//_/')" + docker build --build-arg from=$SRC_DOCKER_IMG_NAME -t $DST_DOCKER_IMG_NAME . + docker run --env TRAVIS_TAG=$TRAVIS_TAG --name $DOCKER_CONTAINER_NAME $DST_DOCKER_IMG_NAME + if ! [ -z "$TRAVIS_TAG" ] + then + docker cp $DOCKER_CONTAINER_NAME:/usr/src/vsUTCS/packages . + fi + docker rm $DOCKER_CONTAINER_NAME +else + script/docker-entrypoint.sh $@ +fi + +echo "cibuild Done!" diff --git a/script/clean b/script/clean new file mode 100755 index 000000000..a70646ce9 --- /dev/null +++ b/script/clean @@ -0,0 +1,44 @@ +#!/bin/bash +#==================================== +# @file : clean +# @brief : clean vsUTCS build dirs and files +# @usage : script/clean +# @param : none +#==================================== + +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +set +e + +echo "--------------------------" +echo "--- clean | 2020-08-24 ---" +echo "--------------------------" +echo "!!!warning!!! for strict developer use" +echo "--------------------------" + +ROOT_DIR=$(pwd) +BUILD_DIR=$ROOT_DIR/build + +echo "deleting build directory ($BUILD_DIR)" +rm -r $BUILD_DIR + +echo "deleting compiled python files (*.pyc)" +find $DATA_DIR -name "*.pyc" -delete + +echo "clean done!" diff --git a/script/docker-entrypoint.sh b/script/docker-entrypoint.sh new file mode 100755 index 000000000..30ad07639 --- /dev/null +++ b/script/docker-entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/bash +#==================================== +# @file: docker-entrypoint.sh +# @brief Docker entry point +# +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +set -e + +script/build +if ! [ -z "$TRAVIS_TAG" ] +then + script/package +fi diff --git a/script/package b/script/package new file mode 100755 index 000000000..b9ee61a83 --- /dev/null +++ b/script/package @@ -0,0 +1,104 @@ +#!/bin/bash + +#==================================== +# @file: package +# @brief package up vsUTCS +# @usage : script/package +# @param : none +# +# Copyright (C) 2020 Stephen G. Tuggy and other vsUTCS contributors +# +# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). +# +# vsUTCS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# vsUTCS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vsUTCS. If not, see . + + +ROOT_DIR=$(pwd) +BUILD_DIR=$ROOT_DIR/build +SRC_DIR=$ROOT_DIR +COMMAND="" +PACKAGE_DIR=$ROOT_DIR/packages + +function copyDebFiles() +{ + # Verify that there are Debian files to copy + local DEB_FILES=`ls *.deb` + if [[ ${#DEB_FILES} ]]; then + # Copy the Debian Package files + for DEB_FILE in ${DEB_FILES} + do + echo "Copying ${DEB_FILE} to ${PACKAGE_DIR}" + cp "${DEB_FILE}" "${PACKAGE_DIR}" + done + else + echo "No Debian Package files" + fi +} + +function copyRpmFiles() +{ + local RPM_FILES=`ls *.rpm *.srpm` + if [[ ${#RPM_FILES} ]]; then + # Copy the Red Hat RPM Package files + for RPM_FILE in ${RPM_FILES} + do + echo "Copying ${RPM_FILE} to ${PACKAGE_DIR}" + cp "${RPM_FILE}" "${PACKAGE_DIR}" + done + else + echo "No RPM Package files" + fi +} + +function copyTarballs() +{ + local TAR_FILES=`ls *.tar.*` + if [[ ${#TAR_FILES} ]]; then + # Copy the Tarball Package files + for TAR_FILE in ${TAR_FILES} + do + echo "Copying ${TAR_FILE} to ${PACKAGE_DIR}" + cp "${TAR_FILE}" "${PACKAGE_DIR}" + done + else + echo "No Tarball Package files" + fi +} + +function copyFiles() +{ + # Ensure the package output directory exists + mkdir -p ${PACKAGE_DIR} + + copyDebFiles + copyRpmFiles + copyTarballs +} + +function buildPackages() +{ + make package + make package_source +} + +echo "----------------------------" +echo "--- package | 2020-08-23 ---" +echo "----------------------------" + +cd $BUILD_DIR + +buildPackages +copyFiles + +cd $ROOT_DIR