diff --git a/.cicd/.dockerignore b/.cicd/.dockerignore new file mode 100644 index 0000000..95520b4 --- /dev/null +++ b/.cicd/.dockerignore @@ -0,0 +1,24 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md diff --git a/.cicd/.gitattributes b/.cicd/.gitattributes new file mode 100644 index 0000000..7418f43 --- /dev/null +++ b/.cicd/.gitattributes @@ -0,0 +1 @@ +runenv.sh text eol=lf \ No newline at end of file diff --git a/.cicd/.gitignore b/.cicd/.gitignore new file mode 100644 index 0000000..e39a2b6 --- /dev/null +++ b/.cicd/.gitignore @@ -0,0 +1,3 @@ +build/* +AtomicGameRoot/* +*.zip diff --git a/.cicd/AtomicGameRoot/.empty b/.cicd/AtomicGameRoot/.empty new file mode 100644 index 0000000..e69de29 diff --git a/.cicd/build/.empty b/.cicd/build/.empty new file mode 100644 index 0000000..e69de29 diff --git a/.cicd/docker-compose.yml b/.cicd/docker-compose.yml new file mode 100644 index 0000000..55dea77 --- /dev/null +++ b/.cicd/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.4' + +services: + atomic: + image: atomic + container_name: atomic + volumes: + - /d/Projekte/fpc_atomic/bomber/:/AtomicGameRoot:ro + - ${PWD}/build:/build + environment: + - ATOMIC_BUILD_WIN64=false + - ATOMIC_BUILD_WIN32=false + - ATOMIC_BUILD_LINUX=true + - ATOMIC_EXTRA_ANI=true + #tty: true + #stdin_open: true + #command: bash diff --git a/.cicd/dockerfile b/.cicd/dockerfile new file mode 100644 index 0000000..b7e756c --- /dev/null +++ b/.cicd/dockerfile @@ -0,0 +1,22 @@ +FROM wimmercg/lazarus-docker:1.1.0 +#FROM lazarus-base + +LABEL Name="FCP Source and Lazarus Git main, Linux64 and Win32, Win64 crosscompile with lazbuild" + +RUN apt update && apt install subversion -y +RUN mkdir /build && mkdir -p /source && mkdir -p /temp + +# FPC-Atomic GIT clone +RUN git clone https://github.com/PascalCorpsman/fpc_atomic.git /source/fpc_atomic +# Pre-Requisites for FPC-Atomic +RUN wget https://www.un4seen.com/files/bass24.zip && unzip -j bass24.zip x64/bass.dll -d /temp && unzip -j bass24.zip delphi/bass.pas -d /source/fpc_atomic +RUN mkdir -p /source/fpc_atomic/lib/x86_64-linux && wget https://www.un4seen.com/files/bass24-linux.zip && unzip -j bass24-linux.zip libs/x86_64/libbass.so -d /source/fpc_atomic/ +RUN wget https://raw.githubusercontent.com/SaschaWillems/dglOpenGL/master/dglOpenGL.pas -O /source/fpc_atomic/dglOpenGL.pas && cp /source/fpc_atomic/dglOpenGL.pas /source/fpc_atomic/cd_data_extractor/ + +RUN mkdir -p /source/synapse && cd /source/synapse && svn checkout https://svn.code.sf.net/p/synalist/code/trunk . && mv /source/synapse/* /source/fpc_atomic/ +RUN /install_corpsman_lnet.sh + +COPY runenv.sh /runenv.sh +RUN chmod 777 /runenv.sh + +CMD /runenv.sh \ No newline at end of file diff --git a/.cicd/mountAtomicRoot.sh b/.cicd/mountAtomicRoot.sh new file mode 100644 index 0000000..739faf2 --- /dev/null +++ b/.cicd/mountAtomicRoot.sh @@ -0,0 +1,4 @@ +#!/bin/bash +#docker run -it -v /${PWD}/AtomicGameRoot:/AtomicGameRoot -v /${PWD}/build:/build atomic bash +#docker run -it -v //d/Projekte/fpc_atomic/bomber/:/AtomicGameRoot -v /${PWD}/build:/build atomic bash +docker-compose -f docker-compose.yml up \ No newline at end of file diff --git a/.cicd/package.json b/.cicd/package.json new file mode 100644 index 0000000..f6eda58 --- /dev/null +++ b/.cicd/package.json @@ -0,0 +1,13 @@ +{ + "name": "build", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "make": "docker build . -t atomic", + "run": "(docker container rm atomic || true) && docker run --name atomic atomic ", + "it": "docker run -it atomic /bin/bash", + "up": "docker compose up -d && docker exec -it cicd_atomic_1 bash ; docker compose down" + }, + "author": "" +} diff --git a/.cicd/runenv.sh b/.cicd/runenv.sh new file mode 100644 index 0000000..efafc07 --- /dev/null +++ b/.cicd/runenv.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -x + +cd /source/fpc_atomic +git pull + +rm -r /build/* +mkdir -p /build/DATA +cp /temp/bass.dll /build/ + +if [ "$ATOMIC_BUILD_LINUX" == "true" ] +then + cd /source/fpc_atomic/ && lazbuildl64 fpc_atomic.lpi && mv fpc_atomic /build +fi + +if [ "$ATOMIC_BUILD_WIN64" == "true" ] +then + cd /source/fpc_atomic/ && lazbuildw64 fpc_atomic.lpi && mv fpc_atomic.exe /build +fi + +if [ "$ATOMIC_BUILD_WIN32" == "true" ] +then + cd /source/fpc_atomic/ && lazbuildw32 fpc_atomic.lpi && mv fpc_atomic.exe /build/fpc_atomic32.exe +fi + +if [ -z "$(ls -A /AtomicGameRoot)" ] +then + echo "/AtomicGameRoot is empty" +else + echo Found AtomicGameRoot DATA. Copying to build/DATA folder + + cd /source/fpc_atomic/cd_data_extractor && lazbuildl64 cd_data_extractor_nogui.lpi && lazbuildw64 cd_data_extractor_nogui.lpi + # TODO: executing a CLI version of cd_data_extractor to convert data from /AtomicGameRoot/DATA/ to /build/DATA/ + + cp cd_data_extractor_nogui /build + cp cd_data_extractor_nogui.exe /build + + # not working due to gtk error on linux + #./cd_data_extractor_nogui -cd /AtomicGameRoot -atomic /build + # cp -r /AtomicGameRoot/DATA/* /build/DATA/ + + if [ "$ATOMIC_EXTRA_ANI" == "true" ] + then + echo Download extra content + wget https://www.oocities.org/timessquare/tower/4056/download/ani.zip --no-check-certificate -O /temp/ani.zip && unzip -jo /temp/ani.zip -d /build/DATA/ANI + fi +fi +