Commit 0e404abf authored by vgmoose's avatar vgmoose 🌱
Browse files

CI: switch to archlinux containers instead of ubuntu

parent 0d0409a8
image: ubuntu:18.04
image: archlinux
variables:
GIT_SUBMODULE_STRATEGY: recursive
......
language: cpp
services:
- docker
matrix:
include:
- env: PLATFORM=pc
- env: PLATFORM=pc-sdl1
- env: PLATFORM=wiiu
- env: PLATFORM=wii
- env: PLATFORM=switch
- env: PLATFORM=3ds
script:
- docker run -e PLATFORM="$PLATFORM"
-v $(pwd):/code ubuntu:18.04
-e VPN_INFO="$VPN_INFO" --cap-add=NET_ADMIN
-v $(pwd):/code archlinux
/bin/bash -c "cd /code && ./dependency_helper.sh && ./build.sh"
env:
global:
- secure: uRXzxPetw4ia+tEH1gLU2NDph8116AQUkUZn0sSlDKkOsvYhdEUkMdrPlKLqpD6Wn5kwEemSSpwTVpmfQO8/k0H3DCHnJc8ynb3UZyVIvNs84KYTY5wWGNgKABXVt/TlyJmK2S2YHheJgQJ1StMjUPPMCGJFL4R4D1vfBSHGd21ons2XLO14f/CghedVDuBffAg1gZnqtA7ZfWCWzxzisaxTcSLU98MyvCokZcT1Xk5ODqUPKK0DO95XXxY8jyJtOcLpvnwfP4/iYWjytTfEcuJpSK30DGsiryDO45+FSXjCScyiiblBXRJIGw+Fgn5gOOuFBy/LBb04R5v0leR9Qf8cPdqRjFxGpODVJ/lJ1j5Y4Ix8PZSRHTFZT3rWSkuK4Z2dMdbTv3xtDPmjAkOMC90LTz8K1N2xhxIZT+1HqMA6UpgKl1TjMr3xGuLkA1cwaYlbREPHT5iFx+7HaF/M2+O2k3AFmKwDtXzfUngHn1CjjwXAXEUg6M502al731IIJIWbCePVUVLk2RAM2S5IYMsKNyCgsFXMu5VBTBnaIR7TDaJQsDED2zNruoJzeQJxfxCmrsFOHqbA9dAe9sdoq+4+cXshrluOypPNY5A6PBdspkWEkKLpAzTnO7zt3zIs6sjXt39ThQXQwCuxzCr/KqtrOw1mwzN7tiyHAm1zlYs=
......@@ -16,7 +16,7 @@ SRC = $(wildcard *.cpp) $(wildcard ./gui/*.cpp) $(wildcard $(CHESTO)/*.cpp) $(wi
OBJ_NAME = appstore.bin
# Options, etc
COMPILER_FLAGS = -g -std=gnu++14 -DPC -DSDL1 -DNETWORK -Wno-narrowing
INCLUDE_DIRS = -I . -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include
INCLUDE_DIRS = -I . -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -I /usr/include/SDL
LINKER_FLAGS = -lSDL -lSDLmain -lSDL_image -lSDL_ttf -lSDL_gfx -lcurl -lz
OBJS := $(patsubst %.cpp,%.o,$(wildcard $(SRC)))
......
......@@ -38,7 +38,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lSDL_ttf -lSDL_gfx -lSDL_mixer -lSDL_image -lfreetype -ljpeg -lpng -lz -lm -lSDL -lfat -lwiiuse -lbte -logc -lwiikeyboard -lbz2
LIBS := -lSDL_ttf -lSDL_gfx -lSDL_mixer -lSDL_image -lfreetype -ljpeg -lpng -lz -lm -lSDL -lfat -lwiiuse -lbte -logc -lwiikeyboard -lbz2
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
......
#!/bin/bash
# This is a dependency helper script to help set up dependencies
# for an Ubuntu Xenial target (used by travis)
# This is a dependency helper script to help set up requirements for running make
# primarly this script is used by the CI, but is also useful when setting up a new env
# Before running it, you should export the desired PLATFORM environment
# variable ( one of pc, pc-sdl1, switch, 3ds, wii, wiiu )
# eg. PLATFORM=switch ./dependency_helper.sh
# this script should work when ran on these OSes:
# - archlinux (uses native pacman)
# - ubuntu:18.04 w/ dkp-pacman (flakey)
# (aka, if you have either pacman or apt-get already)
# TODO: add macOS, WSL (windows), and fedora builds using $OSTYPE checks
# It's probably better to follow the README.md instructions for the
# desired target and platform that you want to build, but this may
# help if you are interested in seeing how the dependencies come together
# on various platforms
# on various platforms, or how the CI works
export HAS_PACMAN="$(command -v pacman)"
export HAS_SUDO="$(command -v sudo)"
main_platform_logic () {
case "${PLATFORM}" in
pc)
setup_deb_sdl_deps || sudo pacman --noconfirm -S sdl2 sdl2_image sdl2_gfx sdl2_ttf
;;
pc-sdl1)
setup_deb_sdl_deps || sudo pacman --noconfirm -S sdl sdl_image sdl_gfx sdl_ttf
;;
switch) # currently libnx
setup_dkp_repo
sudo ${DKP}pacman --noconfirm -S devkitA64 libnx switch-tools switch-curl switch-bzip2 switch-freetype switch-libjpeg-turbo switch-libwebp switch-sdl2 switch-sdl2_gfx switch-sdl2_image switch-sdl2_ttf switch-zlib switch-libpng switch-mesa
;;
3ds) # uses libctru
setup_dkp_repo
sudo ${DKP}pacman --noconfirm -S devkitARM 3ds-sdl 3ds-sdl_image 3ds-sdl_mixer 3ds-sdl_gfx 3ds-sdl_ttf libctru citro3d 3dstools 3ds-curl 3ds-mbedtls
;;
wii) # uses libogc
setup_dkp_repo
sudo ${DKP}pacman --noconfirm -S devkitPPC libogc gamecube-tools wii-sdl wii-sdl_gfx wii-sdl_image wii-sdl_mixer wii-sdl_ttf ppc-zlib ppc-bzip2 ppc-freetype ppc-mpg123 ppc-libpng ppc-pkg-config ppc-libvorbisidec ppc-libjpeg-turbo libfat-ogc
# one day replace with pacman: https://github.com/dborth/sdl-wii/issues/54
sudo apt-get -y install wget git
git clone https://gitlab.com/4TU/sdl-wii.git
export DEVKITPRO=/opt/devkitpro
export DEVKITPPC=$DEVKITPRO/devkitPPC
cd sdl-wii && make && make install
;;
wiiu) # uses wut
setup_fling_repo
sudo ${DKP}pacman --noconfirm -S wut-linux wiiu-sdl2 devkitPPC wiiu-libromfs wiiu-sdl2_gfx wiiu-sdl2_image wiiu-sdl2_ttf wiiu-sdl2_mixer ppc-zlib ppc-bzip2 ppc-freetype ppc-mpg123 ppc-libpng wiiu-curl-headers ppc-pkg-config wiiu-pkg-config
;;
esac
}
install_container_deps () {
apt-get update && apt-get install -y wget sudo libxml2 xz-utils lzma build-essential haveged
haveged &
touch /trustdb.gpg
if [ ! -z $HAS_PACMAN ]; then
pacman --noconfirm -Syuu && pacman --noconfirm -Sy wget sudo base-devel jq git strongswan
pacman-key --init
else
apt-get update && apt-get install -y wget sudo libxml2 xz-utils lzma build-essential haveged
haveged &
touch /trustdb.gpg
fi
}
setup_deb_sdl_deps () {
# will return positive exit code if apt-get fails, also just grabs both sdl1 and sdl2
sudo apt-get -y install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-gfx-dev zlib1g-dev gcc g++ libcurl4-openssl-dev wget git libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-gfx1.2-dev
}
setup_fling_repo () {
setup_dkp_repo
# trust quarky signing keys
sudo ${DKP}pacman-key --recv 6F986ED22C5B9003
sudo ${DKP}pacman-key --lsign 6F986ED22C5B9003
sudo echo "
[wiiu-fling]
Server = https://fling.heyquark.com
$(cat $PACMAN_ROOT/etc/pacman.conf)
" | sudo tee $PACMAN_ROOT/etc/pacman.conf
sudo ${DKP}pacman --noconfirm -Syu
}
export DKP=""
export PACMAN_ROOT=""
retry_pacman_sync () {
# some continuous integration IPs are blocked by dkP servers, not sure what other verbiage to use to describe that move other than
# user-hostile! We'll get a new IP for travis to workaround this (Gitlab CI is ok due to using our own runners)
# currently this workaround is only for archlinux OSes, since those are the containers we use on travis
# load VPN info from environment secret
declare -a INFO=($VPN_INFO)
VPN_DATA=${INFO[0]}; VPN_CERT=${INFO[1]}; VPN_USER=${INFO[2]}; VPN_AUTH=${INFO[3]}
VPN_SERVER=$(curl -s $VPN_DATA | jq -r -c "map(select(.features.ikev2) | .domain) | .[]" | sort -R | head -1)
echo "$VPN_USER : EAP \"$VPN_AUTH\"" >> /etc/ipsec.secrets
echo "conn VPN
keyexchange=ikev2
dpdaction=clear
dpddelay=300s
eap_identity=\"$VPN_USER\"
leftauth=eap-mschapv2
left=%defaultroute
leftsourceip=%config
right=${VPN_SERVER}
rightauth=pubkey
rightsubnet=0.0.0.0/0
rightid=%${VPN_SERVER}
rightca=/etc/ipsec.d/cacerts/VPN.pem
type=tunnel
auto=add
" >> /etc/ipsec.conf
wget $VPN_CERT -O /etc/ipsec.d/cacerts/VPN.der >/dev/null 2>&1
openssl x509 -inform der -in /etc/ipsec.d/cacerts/VPN.der -out /etc/ipsec.d/cacerts/VPN.pem
ipsec restart; sleep 5; ipsec up VPN >/dev/null 2>&1
pacman --noconfirm -Syu
# To any dkP staff that may be reading this: Why don't you want developers to use their own scripts for their own CI?
# if it's a bandwidth issue, let's talk, because hosting static resources (like pacman repos) should not be incurring bandwidth charges
# For instance, hb-appstore is statically hosted, and processes several hundred GB a month with no concern about how much bandwidth we use
# (in fact, we're happy to see more downloads!) so I really can't understand the motive behind this move other than to control CI scripts
# In my opinion, this absolutely contradicts the usefulness provided by the pacman repos, and pushes devs towards alternative solutions
# such as using leseratte's historical archives of your tools, or wanting to host their own mirrors
# Instance of dkP staff disdain for build scripts: https://github.com/diasurgical/devilutionX/issues/739
# We build for many different platforms and want to have control our own CI images that we build in (a very reasonable desire!)
# I like shell scripts, they are effective and frequently used in CI across the board, and work on most operating systems (including windows!)
# It's not dkP staff's concern if they don't like the way that we're building our own packages, happy to talk more about this
# Also happy to offer assistance mirroring or rehosting your packages under unconstrained bandwidth!
}
setup_dkp_repo () {
wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
sudo dpkg -i devkitpro-pacman.deb
if [ -z $HAS_PACMAN ]; then
# we don't have a pacman command on this system, try dkP's
setup_dkp_pacman && return
fi
# trust wintermute and fincs signing keys
sudo pacman-key --recv BC26F752D25B92CE272E0F44F7FD5492264BB9D0 62C7609ADA219C60
sudo pacman-key --lsign BC26F752D25B92CE272E0F44F7FD5492264BB9D0 62C7609ADA219C60
sudo echo "
[dkp-libs]
Server = http://downloads.devkitpro.org/packages
[dkp-linux]
Server = http://downloads.devkitpro.org/packages/linux/\$arch/
" | sudo tee --append /etc/pacman.conf
pacman --noconfirm -Syu || retry_pacman_sync
}
install_intel_deps () {
sudo apt-get -y install wget git libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-gfx-dev zlib1g-dev gcc g++ libcurl4-openssl-dev
setup_dkp_pacman () {
# WARNING: this URL for dkp's pacman will become out of date, check https://github.com/devkitPro/pacman/releases/ for the latest URL
# dkP team is aware of this issue and chooses to remove older download links specifically to not support using build scripts like this one
wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb
sudo dpkg -i devkitpro-pacman.deb
DKP="dkp-"
PACMAN_ROOT="/opt/devkitpro/pacman/"
dkp-pacman --noconfirm -Syu || retry_pacman_sync
}
if ! [ -x "$(command -v sudo)" ]; then
if [ -z $HAS_SUDO ]; then
install_container_deps
fi
case "${PLATFORM}" in
pc)
install_intel_deps
;;
pc-sdl1)
sudo apt-get -y install wget git libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-gfx1.2-dev zlib1g-dev gcc g++ libcurl4-openssl-dev
;;
switch) # currently libnx
setup_dkp_repo
sudo dkp-pacman --noconfirm -S devkitA64 libnx switch-tools switch-curl switch-bzip2 switch-freetype switch-libjpeg-turbo switch-libwebp switch-sdl2 switch-sdl2_gfx switch-sdl2_image switch-sdl2_ttf switch-zlib switch-libpng switch-mesa
;;
3ds)
setup_dkp_repo
sudo dkp-pacman --noconfirm -S devkitARM 3ds-sdl 3ds-sdl_image 3ds-sdl_mixer 3ds-sdl_gfx 3ds-sdl_ttf libctru citro3d 3dstools 3ds-curl 3ds-mbedtls
;;
wii)
setup_dkp_repo
sudo dkp-pacman --noconfirm -S devkitPPC libogc gamecube-tools ppc-zlib ppc-bzip2 ppc-freetype ppc-mpg123 ppc-libpng ppc-pkg-config ppc-libvorbisidec ppc-libjpeg-turbo libfat-ogc
# one day replace with pacman: https://github.com/dborth/sdl-wii/issues/54
sudo apt-get -y install wget git
git clone https://gitlab.com/4TU/sdl-wii.git
export DEVKITPRO=/opt/devkitpro
export DEVKITPPC=$DEVKITPRO/devkitPPC
cd sdl-wii && make && make install
;;
wiiu) # uses wut
setup_dkp_repo
sudo dkp-pacman-key --recv 6F986ED22C5B9003
sudo dkp-pacman-key --lsign 6F986ED22C5B9003
sudo echo "
[wiiu-fling]
Server = https://fling.heyquark.com
$(cat /opt/devkitpro/pacman/etc/pacman.conf)" | sudo tee /opt/devkitpro/pacman/etc/pacman.conf
sudo dkp-pacman -Syu
sudo dkp-pacman --noconfirm -S wut-linux wiiu-sdl2 devkitPPC wiiu-libromfs wiiu-sdl2_gfx wiiu-sdl2_image wiiu-sdl2_ttf wiiu-sdl2_mixer ppc-zlib ppc-bzip2 ppc-freetype ppc-mpg123 ppc-libpng wiiu-curl-headers ppc-pkg-config wiiu-pkg-config
;;
esac
main_platform_logic
Specific instructions for various platforms are covered here!
### Building for Switch (with libnx)
1. Install [dkp-pacman](https://devkitpro.org/viewtopic.php?f=13&t=8702)
2. Install devkitA64 and needed Switch dependencies via dkp-pacman:
......@@ -16,7 +18,7 @@ If all goes well, `appstore.nro` should be sitting in the current directory.
### Building for Wii U (with WUT)
1. Install [dkp-pacman](https://devkitpro.org/viewtopic.php?f=13&t=8702)
2. Setup [wiiu-fling](https://gitlab.com/QuarkTheAwesome/wiiu-fling#wiiu-fling) according to the instructions
2. Setup [wiiu-fling](https://gitlab.com/QuarkTheAwesome/wiiu-fling#wiiu-fling) according to the instructions (**NOTICE**: at this time of writing the fling repo's will need to go above the dkp ones in order to properly build with SDL)
3. Install devkitPPC and needed Wii U dependencies via dkp-pacman:
```
sudo dkp-pacman -S wut wiiu-sdl2 devkitPPC wiiu-libromfs wiiu-sdl2_gfx wiiu-sdl2_image wiiu-sdl2_ttf wiiu-sdl2_mixer ppc-zlib ppc-bzip2 ppc-freetype ppc-mpg123 ppc-libpng wiiu-curl-headers ppc-pkg-config wiiu-pkg-config
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment