Skip to content

Commit

Permalink
Merge pull request #987 from splewis/sm_1.11
Browse files Browse the repository at this point in the history
Compile with SM 1.11
  • Loading branch information
nickdnk committed Feb 28, 2023
2 parents 218e448 + 3077bb9 commit b778e5c
Show file tree
Hide file tree
Showing 22 changed files with 303 additions and 252 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
OUTPUT_PATH: output/get5
OUTPUT_SM_PATH: output/get5/addons/sourcemod
SM_JSON_INC_PATH: get5/dependencies/sm-json/addons/sourcemod/scripting/include
STEAMWORKS_URL: https://raw.githubusercontent.com/PhlexPlexico/SteamWorks/master/Pawn/includes/SteamWorks.inc
STEAMWORKS_URL: https://raw.githubusercontent.com/hexa-core-eu/SteamWorks/main/Pawn/includes/SteamWorks.inc
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -23,7 +23,7 @@ jobs:

- uses: rumblefrog/setup-sp@master
with:
version: '1.10.x'
version: '1.11.x'

- name: Get shorthand commit.
id: vars
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
OUTPUT_PATH: output/get5
OUTPUT_SM_PATH: output/get5/addons/sourcemod
SM_JSON_INC_PATH: get5/dependencies/sm-json/addons/sourcemod/scripting/include
STEAMWORKS_URL: https://raw.githubusercontent.com/PhlexPlexico/SteamWorks/master/Pawn/includes/SteamWorks.inc
STEAMWORKS_URL: https://raw.githubusercontent.com/hexa-core-eu/SteamWorks/main/Pawn/includes/SteamWorks.inc
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -24,7 +24,7 @@ jobs:

- uses: rumblefrog/setup-sp@master
with:
version: '1.10.x'
version: '1.11.x'

- name: Get shorthand commit.
id: vars
Expand Down
40 changes: 11 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
FROM debian:11
MAINTAINER Alexander Volz (Alexander@volzit.de)
FROM debian:11-slim
ENV SMVERSION 1.11

ENV SMVERSION 1.10
RUN apt-get update -y \
&& apt-get install -y wget git lib32stdc++6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV _clean="rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*"
ENV _apt_clean="eval apt-get clean && $_clean"

# Install support pkgs
RUN apt-get update -qqy && DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl wget nano net-tools gnupg2 git lib32stdc++6 python \
tar bash && $_apt_clean
# Install pip2
RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py && python2 get-pip.py

RUN mkdir /get5
RUN mkdir /runscripts
RUN mkdir /get5src
RUN mkdir /runscripts /get5 /get5_src /get5_build
COPY dockerrunscript.sh /runscripts
WORKDIR /get5

RUN git clone https://github.com/splewis/sm-builder
WORKDIR /get5/sm-builder
RUN pip install --user -r requirements.txt
RUN python setup.py install --prefix=~/.local
WORKDIR /get5

ENV SMPACKAGE http://sourcemod.net/latest.php?os=linux&version=${SMVERSION}
RUN wget -q ${SMPACKAGE}
RUN tar xfz $(basename ${SMPACKAGE})
RUN wget ${SMPACKAGE} -O - | tar -xz
RUN chmod +x /get5/addons/sourcemod/scripting/spcomp
ENV PATH "$PATH:/get5/addons/sourcemod/scripting:/root/.local/bin"
ENV PATH "$PATH:/get5/addons/sourcemod/scripting"
WORKDIR /get5/addons/sourcemod/scripting/include
RUN wget https://raw.githubusercontent.com/PhlexPlexico/SteamWorks/master/Pawn/includes/SteamWorks.inc
RUN wget https://raw.githubusercontent.com/hexa-core-eu/SteamWorks/main/Pawn/includes/SteamWorks.inc
WORKDIR /get5

VOLUME /get5/builds
VOLUME /get5src
CMD ["/runscripts/dockerrunscript.sh"]
ENTRYPOINT ["/runscripts/dockerrunscript.sh"]
45 changes: 40 additions & 5 deletions dockerrunscript.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
#!/bin/bash
cd /get5src && git submodule update --init
cp -rf /get5src/* /get5/
cd /get5
cp -r ./dependencies/sm-json/addons/sourcemod/scripting/include/* ./addons/sourcemod/scripting/include
smbuilder --flags='-E'
set -e

WORKING_ROOT=/get5
SM_INCLUDE_PATH=$WORKING_ROOT/addons/sourcemod/scripting/include

SRC_ROOT=/get5_src
SM_JSON_ROOT=$SRC_ROOT/dependencies/sm-json

BUILD_ROOT=/get5_build
GET5_OUTPUT_ROOT=$BUILD_ROOT/get5
PLUGINS_OUTPUT_ROOT=$BUILD_ROOT/plugins
SM_OUTPUT_ROOT=$GET5_OUTPUT_ROOT/addons/sourcemod
SM_OUTPUT_PLUGINS=$SM_OUTPUT_ROOT/plugins

if [ ! -d "$SM_JSON_ROOT" ]; then
echo "Error: sm-json dependency not found; please run 'git submodule update --init' from the repository root."
exit 1;
fi

echo "Copying source files from host..."
# Copy the mounted source files into the /get5 working directory, overwriting any files
cp -rf $SRC_ROOT/scripting $WORKING_ROOT/scripting
# Move the sm-json includes into the SM include directory
echo "Copying sm-json includes..."
cp -rf $SM_JSON_ROOT/addons/sourcemod/scripting/include/* $SM_INCLUDE_PATH
mkdir -p $SM_OUTPUT_PLUGINS
for file in "$@"
do
echo "Compiling '$file'.sp...";
spcomp -v0 -i $SM_INCLUDE_PATH -E -o $SM_OUTPUT_PLUGINS/$file.smx $WORKING_ROOT/scripting/$file.sp
done
echo "Copying source files and translations..."
# Copy translations, configs and cfg to their correct destination
cp -rf $SRC_ROOT/translations $SM_OUTPUT_ROOT
cp -rf $SRC_ROOT/configs $SM_OUTPUT_ROOT
cp -rf $SRC_ROOT/cfg $SRC_ROOT/LICENSE $SRC_ROOT/README.md $GET5_OUTPUT_ROOT
# Copy the compiled .smx files to /plugins of the build output as well:
mkdir -p $PLUGINS_OUTPUT_ROOT
cp -f $SM_OUTPUT_PLUGINS/*.smx $PLUGINS_OUTPUT_ROOT
echo "Build completed."
27 changes: 24 additions & 3 deletions documentation/docs/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,34 @@ Get5 [from source](https://github.com/splewis/get5). A precompiled image is avai
docker pull nickdnk/get5-build:latest
```

If run from the repository root, this would put the compiled plugin into a `builds` folder. You could of course replace
`$PWD/builds` with any other path to move the output there.
Before you build, please ensure you have installed the [`sm-json`](https://github.com/clugg/sm-json) dependency, which
is configured as a submodule. The Docker container does not do this because it can cause file permission issues with
the repository.

```shell
docker run --rm -v $PWD:/get5src -v $PWD/builds:/get5/builds nickdnk/get5-build:latest
git submodule update --init
```

You must mount two volumes for the build to succeed:

1. `/get5_src` should be mounted to the repository root.
2. `/get5_build` should be mounted where you want the output build files. Note that this directory and all its files may
belong to `root`.

```shell
docker run --rm \
-v $PWD:/get5_src \
-v $PWD/build:/get5_build \
nickdnk/get5-build:latest \
get5
```

!!! tip "Good to know"

`$PWD` means "current directory", so in this case, this command would assume you are in the repository root, and the
output will end up in a folder called `/build` within there. `\` in the script just escapes the new-line, so the
command is easier to read.

!!! warning "Custom builds are unsupported"

Note that while building Get5 yourself may seem easy, we do not provide support for custom builds. If you want to
Expand Down

0 comments on commit b778e5c

Please sign in to comment.