ci: migrate to GitHub Actions

* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds

* scripts: cleanup of old CI scripts

* scripts: now port to GitHub Actions

* actions: fix extras checkout

* github: remove codeql action, turned out not to be very useful

* github: remove quiet flag on wget

* github: are we allowed to use envvars?

* github: add needed dependencies for linux

* github: install wget for windows

* scripts: convert our CPU architecture naming into what AppImage uses

* github: run scripts with bash explicitly

* github: first try to upload to GitHub Releases, enable amd64 win32 builds

* Use our uploadtool fork

* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts

* gha: try to fix build

* travis: try to fix build

* gha: try to fix upload, fix win32 build

* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build

* gha: add llvm repository, install clang-12 for android

* gha: motomagx: fail fast

* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip

* waifulib: xcompile: respect environment variables when using host compiler for Android

* waifulib: xcompile: use correct environ dict

* gha: try to fix -fuse-ld=lld with clang-12

* waifulib: xcompile: fix typo

* scripts: xcompile: fix motomagx build

* mainui: upgrade

* gha: fix android build, last time

* engine: wscript: disable crashhandler for magx
This commit is contained in:
Alibek Omarov #SupportRMS 2021-07-03 20:21:09 +03:00 committed by GitHub
parent 9287a0f5c5
commit 21a31ec81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 417 additions and 537 deletions

View File

@ -7,8 +7,8 @@ task:
- pkg install -y git sdl2 python
- git submodule update --init --recursive
test_script:
# - ./scripts/build_freebsd_engine.sh dedicated
- ./scripts/build_freebsd_engine.sh
- ./scripts/cirrus/build_freebsd.sh dedicated
- ./scripts/cirrus/build_freebsd.sh full
task:
name: freebsd-12-amd64
@ -19,8 +19,8 @@ task:
- pkg install -y git sdl2 python
- git submodule update --init --recursive
test_script:
# - ./scripts/build_freebsd_engine.sh dedicated
- ./scripts/build_freebsd_engine.sh
- ./scripts/cirrus/build_freebsd.sh dedicated
- ./scripts/cirrus/build_freebsd.sh full
task:
name: freebsd-13-amd64
@ -31,5 +31,5 @@ task:
- pkg install -y git sdl2 python
- git submodule update --init --recursive
test_script:
# - ./scripts/build_freebsd_engine.sh dedicated
- ./scripts/build_freebsd_engine.sh
- ./scripts/cirrus/build_freebsd.sh dedicated
- ./scripts/cirrus/build_freebsd.sh full

71
.github/workflows/c-cpp.yml vendored Normal file
View File

@ -0,0 +1,71 @@
name: Build & Deploy Engine
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-18.04
targetos: linux
targetarch: amd64
- os: ubuntu-18.04
targetos: linux
targetarch: i386
- os: ubuntu-18.04
targetos: android
targetarch: 32
- os: ubuntu-18.04
targetos: android
targetarch: 64
- os: ubuntu-18.04
targetos: motomagx
targetarch: armv6
- os: windows-latest
targetos: win32
targetarch: amd64
- os: windows-latest
targetos: win32
targetarch: i386
env:
SDL_VERSION: 2.0.14
GH_CPU_ARCH: ${{ matrix.targetarch }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANDROID_SDK_TOOLS_VER: 4333796
ANDROID_NDK_VER: r10e
UPLOADTOOL_ISPRERELEASE: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Checkout xash-extras
if: matrix.targetos != 'android'
uses: actions/checkout@v2
with:
repository: FWGS/xash-extras
path: xash-extras
- name: Install dependencies
run: bash scripts/gha/deps_${{ matrix.targetos }}.sh
- name: Build engine
run: bash scripts/gha/build_${{ matrix.targetos }}.sh
- name: Upload engine (android)
if: matrix.targetos == 'android'
run: bash scripts/continious_upload.sh xashdroid-${{ matrix.targetarch }}.apk
- name: Upload engine (motomagx)
if: matrix.targetos == 'motomagx'
run: bash scripts/continious_upload.sh xash3d-fwgs-magx.7z
- name: Upload engine (linux)
if: matrix.targetos == 'linux'
run: bash scripts/continious_upload.sh xash3d-fwgs-${{ matrix.targetarch }}.AppImage xashds-linux-${{ matrix.targetarch }}
- name: Upload engine (windows)
if: matrix.targetos == 'win32'
run: bash scripts/continious_upload.sh xash3d-fwgs-win32-${{ matrix.targetarch }}.7z xash3d-fwgs-vc2008-sln-${{ matrix.targetarch }}.7z

View File

@ -1,64 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 19 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['cpp']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
- run: |
sudo apt update
sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev
./waf configure -T release -8
./waf build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -3,211 +3,33 @@ compiler: gcc
sudo: false
env:
global:
- SDL_VERSION=2.0.8
- DEPLOY_BRANCH=anewengine
- SDL_VERSION=2.0.14
git:
depth: 50
submodules: true
jdk:
- oraclejdk8
jobs:
include:
- stage: init
name: "Initialize webdav cache"
os: linux
cache: false
script:
- sh scripts/yadisk_clear.sh
- stage: build
name: "Build for Windows MSVC"
cache: ccache
os: windows
before_script:
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
after_script:
- sh scripts/continious_upload.sh xash3d-win32-vc.7z xash3d-vc2008-sln.7z
- # ...
name: "Build for Linux i686"
cache: ccache
os: linux
dist: xenial
addons:
apt:
packages:
- gcc-multilib
- g++-multilib
- libx11-dev:i386
- libxext-dev:i386
- x11-utils
- libgl1-mesa-dev
- libasound-dev
- libstdc++6:i386
- libfuse2:i386
- zlib1g:i386
- unzip
before_script:
- export ARCH=i686
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
after_script:
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
- # ...
name: "Build for Android"
cache: ccache
os: linux
dist: xenial
language: java # we want xenial, so just java, not android
jdk: openjdk8
addons:
apt:
packages:
- clang-9
- lld-9
- p7zip-full
sources:
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
before_script:
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
- sh scripts/travis_common_deps.sh
- sh scripts/travis_android_deps.sh r10e
- export ANDROID_SDK_HOME=$ANDROID_HOME
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
script:
- cd android
- export ARCHS="armeabi armeabi-v7a x86"
- export TOOLCHAIN="host"
- sh compile.sh release
after_script:
- ccache --show-stats
- sh ../scripts/continious_upload.sh xashdroid.apk
- # ...
name: "Build for Android 64"
cache: ccache
os: linux
dist: xenial
language: java # we want xenial, so just java, not android
jdk: openjdk8
addons:
apt:
packages:
- clang-9
- lld-9
- p7zip-full
sources:
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
before_script:
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
- sh scripts/travis_common_deps.sh
- sh scripts/travis_android_deps.sh r10e
- export ANDROID_SDK_HOME=$ANDROID_HOME
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
script:
- cd android
- export ARCHS="aarch64 x86_64"
- export API=21
- export TOOLCHAIN="host"
- sh compile.sh release
after_script:
- ccache --show-stats
- mv xashdroid.apk xashdroid-64-test.apk
- sh ../scripts/continious_upload.sh xashdroid-64-test.apk
- # ...
name: "Build for Linux amd64"
cache: ccache
os: linux
dist: xenial
addons:
apt:
packages:
- libx11-dev
- libxext-dev
- x11-utils
- libgl1-mesa-dev
- libasound-dev
- libstdc++6
- libfuse2
- unzip
before_script:
- export ARCH=x86_64
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
after_script:
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
# - # ...
# name: "Build for Windows MinGW"
# cache: ccache
# os: linux
# dist: xenial
# addons:
# apt:
# packages:
# - mingw-w64-i686-dev
# - binutils-mingw-w64-i686
# - gcc-mingw-w64-i686
# - g++-mingw-w64-i686
# - p7zip-full
# before_script:
# - sh scripts/travis_common_deps.sh
# - sh scripts/travis_mingw_deps.sh
# script:
# - sh scripts/build_mingw_engine.sh
# after_script:
# - ccache --show-stats
# - sh scripts/continious_upload.sh xash3d-mingw.7z
# - # ...
# name: "Build for OSX"
# cache: ccache
# os: osx
# before_script:
# - sh scripts/travis_common_deps.sh
# - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
# script:
# - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
# after_script:
# - sh scripts/continious_upload.sh xash3d-osx.tar.bz2
- # ...
name: "Build for MotoMAGX"
sudo: true
cache: ccache
os: linux
dist: xenial
addons:
apt:
packages:
- libc6:i386
- libstdc++6:i386
- gcc-multilib
- g++-multilib
- p7zip-full
sources:
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
before_script:
- sh scripts/travis_common_deps.sh
- sh scripts/travis_motomagx_deps.sh
script:
- sh scripts/build_motomagx_engine.sh
after_script:
- cd $TRAVIS_BUILD_DIR
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-magx.7z
- stage: deploy
name: "Deploy to github repo"
os: linux
cache: false
script:
- sh scripts/travis-deploy.sh xash3d-fwgs-i686.AppImage xash3d-fwgs-x86_64.AppImage xash3d-win32-vc.7z xash3d-vc2008-sln.7z xashdroid.apk xashdroid-64-test.apk xashds-linux-i686 xashds-linux-x86_64 xash3d-magx.7z
os: linux
arch:
- aarch64
- ppc64le
- s390x
addons:
apt:
update: true
packages:
- libx11-dev
- libxext-dev
- x11-utils
- libgl1-mesa-dev
- libasound-dev
- libstdc++6
- libfuse2
- unzip
before_script:
- sh scripts/travis/deps_common.sh
- sh scripts/travis/deps_${TRAVIS_OS_NAME}.sh
script:
- sh scripts/travis/build_${TRAVIS_OS_NAME}.sh
after_script:
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.tar.xz xashds-linux-${ARCH}

View File

@ -82,6 +82,9 @@ def configure(conf):
if hasattr(conf.options, 'DLLEMU'):
conf.define_cond('XASH_DLL_LOADER', conf.options.DLLEMU)
if conf.env.MAGX:
conf.define('XASH_CRASHHANDLER', 0)
conf.env.ENGINE_TESTS = conf.options.ENGINE_TESTS
conf.define_cond('XASH_ENGINE_TESTS', conf.env.ENGINE_TESTS)

2
mainui

@ -1 +1 @@
Subproject commit f12659f17f91111b534ed89170480bebc79fbc9e
Subproject commit 136a544f60534cdcd11aea9c236ddd529c71ac11

View File

@ -1,20 +0,0 @@
#!/bin/bash
. scripts/lib.sh
# Build engine
cd $TRAVIS_BUILD_DIR
export CC="ccache i686-w64-mingw32-gcc"
export CXX="ccache i686-w64-mingw32-g++"
export CFLAGS="-static-libgcc -no-pthread -msse2 -O1 -g -gdwarf-2" # add sse2 to workaround mingw multiple definition of MemoryBarrier bug
export CXXFLAGS="-static-libgcc -static-libstdc++ -no-pthread -msse2"
export LDFLAGS="-static-libgcc -static-libstdc++ -no-pthread -Wl,--allow-multiple-definition" # workaround some other mingw bugs
export WINRC="i686-w64-mingw32-windres"
rm -rf build # clean build directory
./waf configure -s "SDL2_mingw/i686-w64-mingw32/" --build-type=none --prefix="." --win-style-install -v --enable-utils || die # can't compile VGUI support on MinGW, due to differnet C++ ABI
./waf build -v || die
cp $TRAVIS_BUILD_DIR/SDL2_mingw/i686-w64-mingw32//bin/SDL2.dll . # Install SDL2
cp vgui_support_bin/vgui_support.dll .
./waf install || die
7z a -t7z $TRAVIS_BUILD_DIR/xash3d-mingw.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on *.dll *.exe

View File

@ -1,12 +0,0 @@
#!/bin/bash
. scripts/lib.sh
# Build engine
cd $TRAVIS_BUILD_DIR
python waf configure -s "$HOME/Library/Frameworks/SDL2.framework/" -T debug --prefix="pkg/" --win-style-install --enable-utils || die
python waf build || die
python waf install || die
cp ~/Library/Frameworks/SDL2.framework/SDL2 pkg/libSDL2.dylib
tar -cjf $TRAVIS_BUILD_DIR/xash3d-osx.tar.bz2 pkg/*

View File

@ -1,28 +0,0 @@
#!/bin/bash
. scripts/lib.sh
# Build engine
cd $TRAVIS_BUILD_DIR
# NOTE: to build with other version use --msvc_version during configuration
# NOTE: sometimes you may need to add WinSDK to %PATH%
./waf.bat configure -s "$TRAVIS_BUILD_DIR/SDL2_VC" -T "debug" --prefix=`pwd` --enable-utils || die
./waf.bat build -v || die
echo After build
./waf.bat install || die
cp $TRAVIS_BUILD_DIR/SDL2_VC/lib/x86/SDL2.dll . # Install SDL2
cp vgui-dev/lib/win32_vc6/vgui.dll .
7z a -t7z $TRAVIS_BUILD_DIR/xash3d-win32-vc.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on *.dll *.exe *.pdb
echo "Generating VC2008 project"
rm -rf vc2008/
mkdir vc2008/
./waf.bat msdev
cp *.sln vc2008/
find . -name "*.vcproj" -exec cp --parents \{\} vc2008/ \;
rm -rf vc2008/vc2008 # HACKHACK
7z a -t7z $TRAVIS_BUILD_DIR/xash3d-vc2008-sln.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r vc2008

View File

@ -6,24 +6,8 @@
set +x
# Disabled until GitHub sends prereleases to email
curl "https://raw.githubusercontent.com/FWGS/uploadtool/gha-fixes/upload.sh" -o upload.sh
chmod +x upload.sh
# wget -O upload.sh "https://raw.githubusercontent.com/FWGS/uploadtool/master/upload.sh"
# chmod +x upload.sh
bash ./upload.sh $*
# export GITHUB_TOKEN=$GH_TOKEN
# ./upload.sh $*
##################################
#
# Yandex.Disk
#
##################################
FOLDER_NAME=$DEPLOY_BRANCH-$TRAVIS_BRANCH
WEBDAV_SRV=https://$YANDEX_DISK_USER:$YANDEX_DISK_TOKEN@webdav.yandex.ru
for file in $*; do
echo "Uploading $file..."
curl -T $file $WEBDAV_SRV/$FOLDER_NAME/$file
done

26
scripts/gha/build_android.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
export ANDROID_SDK_HOME=$GITHUB_WORKSPACE/sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
pushd android
if [[ "$GH_CPU_ARCH" == "32" ]]; then
export ARCHS="armeabi armeabi-v7a x86"
elif [[ "$GH_CPU_ARCH" == "64" ]]; then
export ARCHS="aarch64 x86_64"
elif [[ "$GH_CPU_ARCH" == "32&64" ]]; then
export ARCHS="armeabi armeabi-v7a x86 aarch64 x86_64"
fi
export API=21
export TOOLCHAIN=host
export CC=clang-12
export CXX=clang++-12
export STRIP=llvm-strip-12
sh compile.sh release
if [[ "$GH_CPU_ARCH" == "64" ]]; then
mv xashdroid.apk ../xashdroid-64.apk
else
mv xashdroid.apk ../xashdroid-32.apk
fi

View File

@ -2,39 +2,36 @@
. scripts/lib.sh
if [ "$1" = "dedicated" ]; then
APP=xashds
APPNAME=$APP-linux-$ARCH # since we have no extension, mark executable name that it for linux
else # elif [ "$1" = "full" ]; then
APP=xash3d-fwgs
APPNAME=$APP-$ARCH
fi
if [ ! "$ARCH" ]; then
ARCH=i686
fi
# set up ccache
export CC="ccache gcc"
export CXX="ccache g++"
APP=xash3d-fwgs
APPDIR=$APP.AppDir
APPIMAGE=$APP-$ARCH.AppImage
build_sdl2()
{
cd "$TRAVIS_BUILD_DIR"/SDL2_src || die
if [ "$ARCH" = "i686" ]; then
cd "$BUILDDIR"/SDL2_src || die
if [ "$ARCH" = "i386" ]; then
export CFLAGS="-msse2 -march=i686 -m32 -ggdb -O2"
export LDFLAGS="-m32"
fi
./configure --disable-render --disable-haptic --disable-power --disable-filesystem \
--disable-file --disable-libudev --disable-dbus --disable-ibus \
--disable-ime --disable-fcitx \
--enable-alsa-shared --enable-pulseaudio-shared \
--enable-wayland-shared --enable-x11-shared \
./configure \
--disable-render \
--disable-haptic \
--disable-power \
--disable-filesystem \
--disable-file \
--disable-libudev \
--disable-dbus \
--disable-ibus \
--disable-ime \
--disable-fcitx \
--enable-alsa-shared \
--enable-pulseaudio-shared \
--enable-wayland-shared \
--enable-x11-shared \
--prefix / || die # get rid of /usr/local stuff
make -j2 || die
mkdir -p "$TRAVIS_BUILD_DIR"/SDL2_linux
make install DESTDIR="$TRAVIS_BUILD_DIR"/SDL2_linux || die
mkdir -p "$BUILDDIR"/SDL2_linux
make install DESTDIR="$BUILDDIR"/SDL2_linux || die
export CFLAGS=""
export LDFLAGS=""
}
@ -42,16 +39,15 @@ build_sdl2()
build_engine()
{
# Build engine
cd "$TRAVIS_BUILD_DIR" || die
cd "$BUILDDIR" || die
if [ "$ARCH" = "x86_64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
if [ "$ARCH" = "amd64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
AMD64="-8"
fi
if [ "$APP" = "xashds" ]; then
if [ "$1" = "dedicated" ]; then
./waf configure -T release -d -W $AMD64 || die
elif [ "$APP" = "xash3d-fwgs" ]; then
APPDIR=$APPNAME.AppDir
elif [ "$1" = "full" ]; then
./waf configure --sdl2=SDL2_linux -T release --enable-stb --prefix="$APPDIR" -W $AMD64 --enable-utils || die
else
die
@ -62,10 +58,7 @@ build_engine()
build_appimage()
{
APPDIR=$APPNAME.AppDir
APPIMAGE=$APPNAME.AppImage
cd "$TRAVIS_BUILD_DIR" || die
cd "$BUILDDIR" || die
./waf install || die
@ -73,7 +66,7 @@ build_appimage()
python3 scripts/makepak.py xash-extras/ "$APPDIR/extras.pak"
cp SDL2_linux/lib/libSDL2-2.0.so.0 "$APPDIR/"
if [ "$ARCH" = "i686" ]; then
if [ "$ARCH" = "i386" ]; then
cp vgui-dev/lib/vgui.so "$APPDIR/"
fi
@ -101,26 +94,21 @@ EOF
cat > "$APPDIR/$APP.desktop" <<EOF
[Desktop Entry]
Name=$APP
Icon=$APP
Name=xash3d-fwgs
Icon=xash3d-fwgs
Type=Application
Exec=AppRun
Categories=Game;
EOF
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$ARCH.AppImage"
chmod +x "appimagetool-$ARCH.AppImage"
./appimagetool-$ARCH.AppImage "$APPDIR" "$APPIMAGE"
./appimagetool.AppImage "$APPDIR" "$APPIMAGE"
}
rm -rf build # clean-up build directory
build_engine dedicated
mv build/engine/xash xashds-linux-$ARCH
if [ $APP != "xashds" ]; then
build_sdl2
fi
build_engine
if [ $APP != "xashds" ]; then
build_appimage
else
mv build/engine/xash $APPNAME
fi
rm -rf build
build_sdl2
build_engine full
build_appimage

View File

@ -3,16 +3,16 @@
. scripts/lib.sh
. /opt/toolchains/motomagx/setenv-z6.sh
cd $TRAVIS_BUILD_DIR
cd $GITHUB_WORKSPACE
mkdir -p Xash/valve/cl_dlls
mkdir -p Xash/valve/dlls
cd hlsdk
./waf configure -T fast --enable-magx --enable-simple-mod-hacks build install --destdir=../Xash
./waf configure -T fast --enable-magx --enable-simple-mod-hacks build install --destdir=../Xash || die
cd ../
./waf configure -T fast --enable-magx --win-style-install --prefix='' build install --destdir=Xash/
./waf configure -T fast --enable-magx --win-style-install --prefix='' build install --destdir=Xash/ || die
cat > Xash/run.sh << 'EOF'
mypath=${0%/*}
@ -30,4 +30,4 @@ exec $mypath/xash -dev $@
EOF
7z a -t7z $TRAVIS_BUILD_DIR/xash3d-magx.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r Xash/
7z a -t7z $GITHUB_WORKSPACE/xash3d-fwgs-magx.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r Xash/

37
scripts/gha/build_win32.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
. scripts/lib.sh
# Build engine
cd $BUILDDIR
if [ "$ARCH" = "amd64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
AMD64="-8"
fi
# NOTE: to build with other version use --msvc_version during configuration
# NOTE: sometimes you may need to add WinSDK to %PATH%
./waf.bat configure -s "SDL2_VC" -T "debug" --prefix=`pwd` --enable-utils $AMD64 || die
./waf.bat build -v || die
./waf.bat install || die
if [ "$ARCH" = "i386" ]; then
cp SDL2_VC/lib/x86/SDL2.dll . # Install SDL2
cp vgui-dev/lib/win32_vc6/vgui.dll .
elif [ "$ARCH" = "amd64" ]; then
cp SDL2_VC/lib/x64/SDL2.dll .
else
die
fi
7z a -t7z $BUILDDIR/xash3d-fwgs-win32-$ARCH.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on *.dll *.exe *.pdb
echo "Generating VC2008 project"
rm -rf vc2008/
mkdir vc2008/
./waf.bat msdev
cp *.sln vc2008/
find . -name "*.vcproj" -exec cp --parents \{\} vc2008/ \;
rm -rf vc2008/vc2008 # HACKHACK
7z a -t7z $BUILDDIR/xash3d-fwgs-vc2008-sln-$ARCH.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r vc2008

View File

@ -1,41 +1,53 @@
#!/bin/bash
echo "Install packages"
echo "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main" | sudo tee -a /etc/apt/sources.list
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install clang-12 lld-12 llvm-12 llvm-12-tools p7zip-full
sudo rm /usr/bin/lld /usr/bin/ld.lld
sudo ln -s /usr/bin/lld-12 /usr/bin/lld
sudo ln -s /usr/bin/ld.lld-12 /usr/bin/ld.lld
echo "Download HLSDK"
cd $TRAVIS_BUILD_DIR
cd $GITHUB_WORKSPACE
git clone --depth 1 --recursive https://github.com/FWGS/hlsdk-xash3d -b mobile_hacks hlsdk || exit 1
echo "Download and unpack Android SDK"
mkdir -p sdk && cd sdk
mkdir -p sdk || exit 1
pushd sdk
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -qO sdk.zip > /dev/null || exit 1
unzip -q sdk.zip || exit 1
cd $TRAVIS_BUILD_DIR
popd
echo "Download all needed tools and NDK"
yes | sdk/tools/bin/sdkmanager --licenses > /dev/null 2>/dev/null # who even reads licenses? :)
NDK_BUNDLE="ndk-bundle"
if [ "$1" = "r10e" ]; then
if [ "$ANDROID_NDK_VER" = "r10e" ]; then
NDK_BUNDLE=""
fi
sdk/tools/bin/sdkmanager --install build-tools\;29.0.1 platform-tools platforms\;android-29 $NDK_BUNDLE > /dev/null 2>/dev/null
if [ "$1" = "r10e" ]; then
if [ "$ANDROID_NDK_VER" = "r10e" ]; then
wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -qO ndk.zip > /dev/null || exit 1
unzip -q ndk.zip || exit 1
mv android-ndk-r10e sdk/ndk-bundle
fi
echo "Download Xash3D FWGS Android source"
git clone --depth 1 https://github.com/FWGS/xash3d-android-project -b waf android || exit 1
cd android
echo "Fetching submodules"
git submodule update --init xash-extras || exit 1
pushd android
mv xash3d-fwgs xash3d-fwgs-sub
ln -s $TRAVIS_BUILD_DIR xash3d-fwgs
ln -s $GITHUB_WORKSPACE xash3d-fwgs
echo "Installed Xash3D FWGS source symlink"
mv hlsdk-xash3d hlsdk-xash3d-sub
ln -s $TRAVIS_BUILD_DIR/hlsdk hlsdk-xash3d
echo "Install HLSDK source symlink"
ln -s $GITHUB_WORKSPACE/hlsdk hlsdk-xash3d
echo "Installed HLSDK source symlink"
cd $TRAVIS_BUILD_DIR
mv xash-extras xash-extras-sub
ln -s $GITHUB_WORKSPACE/xash-extras xash-extras
echo "Installed xash-extras symlink"
popd

24
scripts/gha/deps_linux.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
cd $GITHUB_WORKSPACE
if [ "$GH_CPU_ARCH" == "i386" ]; then
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc-multilib g++-multilib libx11-dev:i386 libxext-dev:i386 x11-utils libgl1-mesa-dev libasound-dev libstdc++6:i386 libfuse2:i386 zlib1g:i386
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-i686.AppImage" -O appimagetool.AppImage
elif [ "$GH_CPU_ARCH" == "amd64" ]; then
sudo apt update
sudo apt install gcc-multilib g++-multilib libx11-dev libxext-dev x11-utils libgl1-mesa-dev libasound-dev libstdc++6 libfuse2 zlib1g
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O appimagetool.AppImage
else
exit 1
fi
chmod +x appimagetool.AppImage
wget http://libsdl.org/release/SDL2-$SDL_VERSION.zip -O SDL2.zip
unzip -q SDL2.zip
mv SDL2-$SDL_VERSION SDL2_src

15
scripts/gha/deps_motomagx.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
cd $GITHUB_WORKSPACE
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libstdc++6:i386 gcc-multilib g++-multilib p7zip-full
sudo mkdir -p /opt/toolchains
pushd /opt/toolchains/
sudo git clone https://github.com/a1batross/motomagx_toolchain motomagx --depth=1
popd
git clone https://github.com/FWGS/hlsdk-xash3d hlsdk -b mobile_hacks --depth=1

View File

@ -1,4 +1,5 @@
# SDL2 for VC prebuilt
#!/bin/bash
curl http://libsdl.org/release/SDL2-devel-$SDL_VERSION-VC.zip -o SDL2.zip
unzip -q SDL2.zip
mv SDL2-$SDL_VERSION SDL2_VC

View File

@ -3,3 +3,15 @@ die()
cat build/config.log
exit 1
}
if [ -n "$TRAVIS_BUILD_DIR" ]; then
BUILDDIR=$TRAVIS_BUILD_DIR
elif [ -n "$GITHUB_WORKSPACE" ]; then
BUILDDIR=$GITHUB_WORKSPACE
fi
if [ -n "$TRAVIS_CPU_ARCH" ]; then
ARCH=$TRAVIS_CPU_ARCH
elif [ -n "$GH_CPU_ARCH" ]; then
ARCH=$GH_CPU_ARCH
fi

View File

@ -1,89 +0,0 @@
#!/bin/bash
die()
{
echo $1
exit 1
}
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Travis should not deploy from pull requests"
exit 0
fi
append_readme()
{
for arg in $FILES; do
echo \* [$arg]\(https://github.com/FWGS/xash3d-deploy/blob/$DEPLOY_BRANCH-$TRAVIS_BRANCH/$arg\?raw\=true\) >> README.md
echo >> README.md
done
}
generate_continious_tag()
{
if [ $TRAVIS_BRANCH == "master" ]; then
echo "continuous"
else
echo "continuous-$TRAVIS_BRANCH"
fi
}
generate_readme()
{
TAG=$(generate_continuous_tag)
# echo \# Moved to GitHub Releases at [here]\(https://github.com/FWGS/xash3d-fwgs/releases/tag/$TAG\) >> README.md
# echo >> README.md
# echo >> README.md
# echo >> README.md
# echo >> README.md
echo \# $TRAVIS_BRANCH branch autobuilds from $DEPLOY_BRANCH >> README.md
echo >> README.md
echo Short changelog: >> README.md
echo \`\`\` >> README.md
(cd $TRAVIS_BUILD_DIR; TZ=UTC git log --pretty=format:'%h %ad %s' --date iso-local -n 10 $REV_RANGE)| cut -d ' ' -f 1-3,5-100 >> README.md
echo \`\`\` >> README.md
echo >> README.md
echo [Code on GitHub]\(https://github.com/FWGS/xash3d-fwgs/tree/$TRAVIS_COMMIT\) >> README.md
echo >> README.md
echo [Full changelog for this build]\(https://github.com/FWGS/xash3d-fwgs/commits/$TRAVIS_COMMIT\) >> README.md
echo >> README.md
append_readme
echo $TRAVIS_COMMIT > commit.txt
}
yadisk_download()
{
FOLDER_NAME=$DEPLOY_BRANCH-$TRAVIS_BRANCH
WEBDAV_SRV=https://$YANDEX_DISK_USER:$YANDEX_DISK_TOKEN@webdav.yandex.ru
for file in $*; do
curl -L $WEBDAV_SRV/$FOLDER_NAME/$file -o $file
done
}
PUSHED_COMMIT=$(curl --fail https://raw.githubusercontent.com/FWGS/xash3d-deploy/$DEPLOY_BRANCH-$TRAVIS_BRANCH/commit.txt)
echo "Pushed commit: $PUSHED_COMMIT"
if [ ! -z "$PUSHED_COMMIT" ]; then
REV_RANGE="HEAD...$PUSHED_COMMIT"
else
REV_RANGE="HEAD"
fi
git config --global user.name FWGS-deployer
git config --global user.email FWGS-deployer@users.noreply.github.com
FILES=$*
# Create new repo with new files
mkdir xash3d-deploy
cd xash3d-deploy
git init
git remote add travis-deploy-public https://FWGS-deployer:${GH_TOKEN}@github.com/FWGS/xash3d-deploy.git
git checkout -b $DEPLOY_BRANCH-$TRAVIS_BRANCH
yadisk_download $FILES
generate_readme
git add .
git commit -m "Latest travis deploy $TRAVIS_COMMIT"
git push -q --force travis-deploy-public $DEPLOY_BRANCH-$TRAVIS_BRANCH >/dev/null 2>/dev/null
exit 0

103
scripts/travis/build_linux.sh Executable file
View File

@ -0,0 +1,103 @@
#!/bin/bash
. scripts/lib.sh
APP=xash3d-fwgs
APPDIR=$APP
APPIMAGE=$APP-$ARCH.tar.xz
build_sdl2()
{
cd "$BUILDDIR"/SDL2_src || die
if [ "$ARCH" = "i386" ]; then
export CFLAGS="-msse2 -march=i686 -m32 -ggdb -O2"
export LDFLAGS="-m32"
fi
./configure \
--disable-render \
--disable-haptic \
--disable-power \
--disable-filesystem \
--disable-file \
--disable-libudev \
--disable-dbus \
--disable-ibus \
--disable-ime \
--disable-fcitx \
--enable-alsa-shared \
--enable-pulseaudio-shared \
--enable-wayland-shared \
--enable-x11-shared \
--prefix / || die # get rid of /usr/local stuff
make -j2 || die
mkdir -p "$BUILDDIR"/SDL2_linux
make install DESTDIR="$BUILDDIR"/SDL2_linux || die
export CFLAGS=""
export LDFLAGS=""
}
build_engine()
{
# Build engine
cd "$BUILDDIR" || die
if [ "$ARCH" = "amd64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
AMD64="-8"
fi
if [ "$1" = "dedicated" ]; then
./waf configure -T release -d -W $AMD64 || die
elif [ "$1" = "full" ]; then
./waf configure --sdl2=SDL2_linux -T release --enable-stb --prefix="$APPDIR" -W $AMD64 --enable-utils || die
else
die
fi
./waf build || die
}
build_archive()
{
cd "$BUILDDIR" || die
./waf install || die
# Generate extras.pak
python3 scripts/makepak.py xash-extras/ "$APPDIR/extras.pak"
cp SDL2_linux/lib/libSDL2-2.0.so.0 "$APPDIR/"
if [ "$ARCH" = "i386" ]; then
cp vgui-dev/lib/vgui.so "$APPDIR/"
fi
cat > "$APPDIR"/run.sh << 'EOF'
#!/bin/sh
if [ "$XASH3D_BASEDIR" = "" ]; then
export XASH3D_BASEDIR=$PWD
fi
echo "Xash3D FWGS installed as tarball."
echo "Base directory is $XASH3D_BASEDIR. Set XASH3D_BASEDIR environment variable to override this"
export XASH3D_EXTRAS_PAK1="${XASH3D_BASEDIR}"/extras.pak
export LD_LIBRARY_PATH="${XASH3D_BASEDIR}":$LD_LIBRARY_PATH
${DEBUGGER} "${XASH3D_BASEDIR}"/xash3d "$@"
exit $?
EOF
chmod +x "$APPDIR"/xash3d "$APPDIR"/run.sh # Engine launcher & engine launcher script
echo "Contents of tarball: "
ls -R "$APPDIR"
tar -cJvf $APPIMAGE $APPDIR/*
}
rm -rf build # clean-up build directory
build_engine dedicated
mv build/engine/xash xashds-linux-$ARCH
rm -rf build
build_sdl2
build_engine full
build_archive

View File

@ -1,3 +0,0 @@
# SDL2 for MinGW prebuilt
curl -s http://libsdl.org/release/SDL2-devel-$SDL_VERSION-mingw.tar.gz | tar xzf -
mv SDL2-$SDL_VERSION SDL2_mingw

View File

@ -1,9 +0,0 @@
sudo mkdir -p /opt/toolchains
cd /opt/toolchains/
sudo git clone https://github.com/a1batross/motomagx_toolchain motomagx
cd $TRAVIS_BUILD_DIR
git clone https://github.com/FWGS/hlsdk-xash3d hlsdk -b mobile_hacks --depth=1
git clone https://github.com/mittorn/ref_soft ref_soft --depth=1
sed -i "s|#rsw||" wscript

View File

@ -1,6 +0,0 @@
# brew install python
curl -s https://www.libsdl.org/release/SDL2-$SDL_VERSION.dmg > SDL2.dmg
hdiutil attach SDL2.dmg
cd /Volumes/SDL2
mkdir -p ~/Library/Frameworks
cp -r SDL2.framework ~/Library/Frameworks/

View File

@ -200,16 +200,32 @@ class Android:
def cc(self):
if self.is_host():
return 'clang --target=%s%d' % (self.ndk_triplet(), self.api)
s = 'clang'
environ = getattr(self.ctx, 'environ', os.environ)
if 'CC' in environ:
s = environ['CC']
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc')
def cxx(self):
if self.is_host():
return 'clang++ --target=%s%d' % (self.ndk_triplet(), self.api)
s = 'clang++'
environ = getattr(self.ctx, 'environ', os.environ)
if 'CXX' in environ:
s = environ['CXX']
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++')
def strip(self):
if self.is_host():
environ = getattr(self.ctx, 'environ', os.environ)
if 'STRIP' in environ:
return environ['STRIP']
return 'llvm-strip'
return os.path.join(self.gen_binutils_path(), 'strip')
@ -372,8 +388,6 @@ def configure(conf):
conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']]
conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']]
conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX]
for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']:
conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX')
conf.env.MAGX = conf.options.MAGX
MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' })
@ -390,6 +404,10 @@ def post_compiler_cxx_configure(conf):
if conf.android.ndk_rev == 19:
conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++']
conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++']
elif conf.options.MAGX:
for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']:
conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX')
return
def post_compiler_c_configure(conf):

View File

@ -1,5 +0,0 @@
FOLDER_NAME=$DEPLOY_BRANCH-$TRAVIS_BRANCH
WEBDAV_SRV=https://$YANDEX_DISK_USER:$YANDEX_DISK_TOKEN@webdav.yandex.ru
curl -X DELETE $WEBDAV_SRV/$FOLDER_NAME
curl -X MKCOL $WEBDAV_SRV/$FOLDER_NAME