Skip to content

Commit

Permalink
Update building & depedencies (#48)
Browse files Browse the repository at this point in the history
* Update building & depedencies

* Fix build for clang 7

* Xenial and s3 upload
  • Loading branch information
Amaroq7 committed Nov 10, 2018
1 parent 4be32ea commit 477a2b1
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 77 deletions.
81 changes: 48 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ branches:
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
sudo: required
os: linux
group: travis_latest
dist: xenial

matrix:
include:
- addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
- llvm-toolchain-xenial-6.0
- ubuntu-toolchain-r-test
- deadsnakes #python
- deadsnakes
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
packages:
- clang-5.0
- lld-5.0
- clang-6.0
- lld-6.0
- gcc-multilib
- g++-multilib
- python3.7
Expand All @@ -29,19 +29,19 @@ matrix:
- libc6-dev-i386
- linux-libc-dev
env:
- CLANG_VERSION=5 LINK_TYPE=static
- CLANG_VERSION=6 LINK_TYPE=static
compiler: clang

- addons:
apt:
sources:
- llvm-toolchain-trusty-6.0
- llvm-toolchain-xenial-7
- ubuntu-toolchain-r-test
- deadsnakes #python
- deadsnakes
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
packages:
- clang-6.0
- lld-6.0
- clang-7
- lld-7
- gcc-multilib
- g++-multilib
- python3.7
Expand All @@ -52,19 +52,19 @@ matrix:
- libc6-dev-i386
- linux-libc-dev
env:
- CLANG_VERSION=6 LINK_TYPE=static CC_VERSION=6
- CLANG_VERSION=7 LINK_TYPE=static CC_VERSION=7
compiler: clang

- addons:
apt:
sources:
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
- deadsnakes #python
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
- llvm-toolchain-xenial-7
- ubuntu-toolchain-r-test
- deadsnakes
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
packages:
- clang-6.0
- lld-6.0
- clang-7
- lld-7
- gcc-multilib
- g++-multilib
- python3.7
Expand All @@ -75,14 +75,14 @@ matrix:
- libc6-dev-i386
- linux-libc-dev
env:
- CLANG_VERSION=6 LINK_TYPE=dynamic CC_VERSION=6
- CLANG_VERSION=7 LINK_TYPE=dynamic CC_VERSION=7
compiler: clang

- addons:
apt:
sources:
- ubuntu-toolchain-r-test
- deadsnakes #python3.6
- deadsnakes
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
packages:
- gcc-7
Expand All @@ -104,7 +104,7 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- deadsnakes #python3.6
- deadsnakes
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
packages:
- gcc-8
Expand All @@ -126,8 +126,8 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- deadsnakes #python3.6
- sourceline: 'ppa:ricotz/toolchain' #meson & ninja
- deadsnakes
- sourceline: 'ppa:ricotz/toolchain'
packages:
- gcc-8
- g++-8
Expand All @@ -146,21 +146,36 @@ matrix:

before_script:
- export PATH=/usr/bin:$PATH LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/build:$LD_LIBRARY_PATH
- export COMMIT_NUM="$(git rev-list --count HEAD)"
- export COMMIT_SHORT_SHA="$(git rev-parse --short HEAD)"
- travis/prepare.sh
script:
- travis/build.sh

before_deploy:
- git fetch --unshallow
- travis/package.sh
deploy:
provider: releases
api_key:
secure: LGXp5xFYtOnWozrsn8OpmRBBQN0M62GFjvYK4BFyjnxhYjBXnazFg9EOjr3EKgPm7iS7SgzLjjXNGIaSObVSCyFM5/WTcgcewhY2YdL8BzqsFKE/90s0x5mKilOLZPOGfMHwrWV5tK9KgZsdh4ddScY8uaoqNirbXvqaCz56reTk3rTnE+csAYhM5vtE+SnlSQJf1xlACtP30v5YEtYUw1msyH2S50j+d8ezztQT6PA5xpPJVXAGA2q4Z5AafvhIp1IY7br6BxRY5osyKGOpM7coN+b5oqaTs2PbxaYyZDZFEqGnW4sCVXwdgl4Ps+OAQCLfoLWqa9ALYCW9YD8SOkE3AMksjK5eewmXQ5W61R5ejGmUa7h1zEGd+judrP6qQKDP3tBlD21EFwiflGFkze1ocbYu7xA5tjuMndQ+JFl55Yz14tQdVtQRVi8u398go7ueTnkghkQSZbTS60wMyetoxajVYCEVlPAhrxawhXu30CAbSGdGSLLAntZKFa7N6cN2TvfTZ9S9LuSQopRV4rnH7ekqAnH0FuOIaPZNEt9EO08pGMjVhUnLOk0EHh7VbPrQ8vqOzVcvLgGrbA4tFIFbDXTYzeFg34oqxePyGJToOGxUHD1l6nVFRndtNiNFD8cV2n61kyMKffoU8GmZIxADIGdISJvFKDVJWoLf+Ps=
file: spmod-$TRAVIS_OS_NAME-$TRAVIS_TAG-$CC$CC_VERSION-$LINK_TYPE.tar.xz
skip_cleanup: true
draft: true
tag_name: $TRAVIS_TAG
on:
tags: true
branch: /^v\d+\.\d+(\.\d+)?(-\S*)?$/
condition: $CLANG_VERSION = 6 || $GCC_VERSION = 8
- provider: releases
api_key:
secure: LGXp5xFYtOnWozrsn8OpmRBBQN0M62GFjvYK4BFyjnxhYjBXnazFg9EOjr3EKgPm7iS7SgzLjjXNGIaSObVSCyFM5/WTcgcewhY2YdL8BzqsFKE/90s0x5mKilOLZPOGfMHwrWV5tK9KgZsdh4ddScY8uaoqNirbXvqaCz56reTk3rTnE+csAYhM5vtE+SnlSQJf1xlACtP30v5YEtYUw1msyH2S50j+d8ezztQT6PA5xpPJVXAGA2q4Z5AafvhIp1IY7br6BxRY5osyKGOpM7coN+b5oqaTs2PbxaYyZDZFEqGnW4sCVXwdgl4Ps+OAQCLfoLWqa9ALYCW9YD8SOkE3AMksjK5eewmXQ5W61R5ejGmUa7h1zEGd+judrP6qQKDP3tBlD21EFwiflGFkze1ocbYu7xA5tjuMndQ+JFl55Yz14tQdVtQRVi8u398go7ueTnkghkQSZbTS60wMyetoxajVYCEVlPAhrxawhXu30CAbSGdGSLLAntZKFa7N6cN2TvfTZ9S9LuSQopRV4rnH7ekqAnH0FuOIaPZNEt9EO08pGMjVhUnLOk0EHh7VbPrQ8vqOzVcvLgGrbA4tFIFbDXTYzeFg34oqxePyGJToOGxUHD1l6nVFRndtNiNFD8cV2n61kyMKffoU8GmZIxADIGdISJvFKDVJWoLf+Ps=
file: spmod-$TRAVIS_OS_NAME-$TRAVIS_TAG-$CC$CC_VERSION-$LINK_TYPE.tar.xz
skip_cleanup: true
draft: true
tag_name: $TRAVIS_TAG
on:
tags: true
branch: /^v\d+\.\d+(\.\d+)?(-\S*)?$/
condition: $CLANG_VERSION = 7 || $GCC_VERSION = 8
- provider: s3
local-dir: upload
access_key_id:
secure: g5eMcCQxblr3kXOtnGeAn/HWVLlRilOjU2+DsO/q0pcnkE6mqRQvXRhWt+fHV1YqBXV1JCdzTlGqv48Mt1X0LQMQYn+Gf1WomutQOcdrT9myWXqLLiXTNqqfoq+yBYLbtHDzwzamYu9iAKD5QY8XwcR2k3r4ThrVq/8wkIkU6HVRwhc4FV/oETtSe0E1SyYsMDmJqLg72TXmZdujmiCp34qjQKxOMFxMykoj9O2FcDmv0CMzOjZap8p9H2ove3U+mI+VUeQ9r1eo72tLtLS6ossH94MI9oBJ8NnONo1nnkskL4/GGqEqGnjcuvH3dSQHhpjqLoDOdJKodWFbPBvsjkpOeSmJmhl3rljMM6Jz0s65gkv8ilNVoGUIahvso+vMV3SMKsqjlCBacIBimar9q6BIouXIioHgnafbKJeqFP/aX7TD1mGJl7j3BFKHKXuBln0etlHfvFy7DR00SRBG8DGjRVKEJTwNc75ma5DQuTbSkf+8Tn12mQA+Ei8GGt68J2/ZERjERlszcphPm+E6X+x8x5wPIwJG58kuxzMGnglaV81LceX8gAkRo4pmM5jkIOjXjPRXw77b0DA9ZSQCzGL2LNi0IDk6kN8Z6VRnaflTFGHcbE0d5vGK0jrFls2IJ/EmCfnt1GRV0+10w9/HP+x642Ud4uXWskzE/QhcuKY=
secret_access_key:
secure: sJ7abLWZlcHHBlIjJqJ/w+skr2JqQ7qmuUG8MP3JCxRZCm3YF4n2AXuJGslTMmmyslYhzvO2pDUv/EE6rZoxPCoMTDd+12hG1KgUHec5cJKOd5wxdRL8qmBvGHK26Y4xCqEAL4HfX+NPCIUMSDKhekdux+hiMloJeSB/w4vafR13JADm5kVRgqEA0z1P1qOvK90ZtEFHYDYD0uXzWHtqHJa9Z3VkYjaVF6Nsaq3ElwJqedXskPm4ktwg7J3AXKemmiEti2q8AggvQ1IpvLkr+OhCTBHOurW48R7x/ewpjZz7nRBMEYQU91WPHMD2UAJStiggfZ1CKQyrdxbpd7SdODiJkqfno2UYK2nVmTi2MvjdCxssOZs8X+2iLseIBvIg+X8Hw8/hhsU1ntoNd7EuyInFd4afZjLQ/L7Ey4ai0e02GkW8M+SqQ2urU35Hsfcn5thXWOAH+1MSc96snLAq3RWOa/aW58np+1DDrKa0QFVyhzYXvnQcI5DEIiC+n4emSL2nenjS0zeWCG52IuPHrxBCIjbV29fRrrzWeznLHiqus36IABF5rEfZKPR3RRpYF2Oz8nkvB3IRTxyTH1cDVDxWQg77O4P/9anB1KcP0Tfx4aIzOTaEmGX4dWZq7CeE/TiriqZu1VzIrQNHGVuifAfC1FucrCyq7siAIFrKbDs=
bucket: spmod
region: eu-central-1
skip_cleanup: true
on:
branch: master
condition: $CLANG_VERSION = 7 || $GCC_VERSION = 8
41 changes: 23 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ environment:
matrix:
- LINK_TYPE: dynamic
- LINK_TYPE: static
artifacts:
- path: spmod-win32-$(APPVEYOR_REPO_TAG_NAME)-msvc*-$(LINK_TYPE).7z
name: spmod-build
install:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
- set PATH=C:\Python37-x64;C:\Python37-x64\Scripts;C:\Program Files\Meson;%PATH%
- git submodule update --init --recursive
- mkdir dlls
- cd ..
- ps: Start-FileDownload 'https://github.com/mesonbuild/meson/releases/download/0.47.1/meson-0.47.1-64.msi'
- start /wait msiexec.exe /i meson-0.47.1-64.msi /quiet /qn /norestart /log install.log
- ps: Start-FileDownload 'https://github.com/mesonbuild/meson/releases/download/0.48.1/meson-0.48.1-64.msi'
- start /wait msiexec.exe /i meson-0.48.1-64.msi /quiet /qn /norestart /log install.log
# Install ambuild
- git clone https://github.com/alliedmodders/ambuild.git
- git clone --depth=1 https://github.com/alliedmodders/ambuild.git
- cd ambuild
- python setup.py install
# Build SourcePawn lib
Expand All @@ -47,16 +44,24 @@ build_script:
- ninja
- cd ..
- move build\src\spmod_mm.dll dlls
- 7z a -t7z -mm=LZMA:d256m:fb64 -mx9 spmod-win32-%APPVEYOR_REPO_TAG_NAME%-msvc%APPVEYOR_BUILD_WORKER_IMAGE:~-4%-%LINK_TYPE%.7z dlls scripts
- ps: appveyor\package.ps1
deploy:
description: ''
provider: GitHub
auth_token:
secure: OHpFkNuODntvGsZ4TURitsr5WB5EtsLkOBcqpEX2AEEhP3qsYJAePoUW8CtDB86K
artifact: spmod-build
draft: true
prerelease: false
tag: $(appveyor_repo_tag_name)
on:
branch: /^v\d+\.\d+(\.\d+)?(-\S*)?$/
appveyor_repo_tag: true
- provider: GitHub
description: ''
auth_token:
secure: OHpFkNuODntvGsZ4TURitsr5WB5EtsLkOBcqpEX2AEEhP3qsYJAePoUW8CtDB86K
draft: true
prerelease: false
tag: $(appveyor_repo_tag_name)
on:
branch: /^v\d+\.\d+(\.\d+)?(-\S*)?$/
appveyor_repo_tag: true
- provider: S3
access_key_id:
secure: Zj5Yd5Z4CSA4dV7brcm0/rv+F1+GD+Ym5vQCnjM2d+Y=
secret_access_key:
secure: ocC7RzsSjLEPZ4coQsOYTsvQJOd8lJZ4gqSJczRgak6Kdln6p8+yOZDJ7PbTHmRW
bucket: spmod
region: eu-central-1
on:
branch: master
19 changes: 19 additions & 0 deletions appveyor/package.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {
exit
}

$COMMIT_SHORT_SHA = git rev-parse --short HEAD | Out-String
$COMMIT_NUM = git rev-list --count HEAD | Out-String
$COMMIT_SHORT_SHA = $COMMIT_SHORT_SHA.Trim()
$COMMIT_NUM = $COMMIT_NUM.Trim()
$CC_VERSION = $env:APPVEYOR_BUILD_WORKER_IMAGE.Substring($env:APPVEYOR_BUILD_WORKER_IMAGE.Length - 4)

if ($env:APPVEYOR_REPO_TAG_NAME -eq $null) {
$ARCHIVE_NAME = "spmod-win32-$COMMIT_NUM-$COMMIT_SHORT_SHA-msvc$CC_VERSION-$env:LINK_TYPE.7z"
7z a -t7z -mm=LZMA:d256m:fb64 -mx9 "$ARCHIVE_NAME" dlls scripts
Push-AppveyorArtifact $ARCHIVE_NAME
} else {
$ARCHIVE_NAME = "spmod-win32-$env:APPVEYOR_REPO_TAG_NAME-msvc$CC_VERSION-$env:LINK_TYPE.7z"
7z a -t7z -mm=LZMA:d256m:fb64 -mx9 "$ARCHIVE_NAME" dlls scripts
Push-AppveyorArtifact $ARCHIVE_NAME
}
2 changes: 1 addition & 1 deletion include/metamod-r
2 changes: 1 addition & 1 deletion include/rehlds
2 changes: 1 addition & 1 deletion include/sourcepawn
Submodule sourcepawn updated 221 files
23 changes: 16 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ if build_machine.system() == 'linux'
gLinkArgs += '-m32'

if cppCompiler.get_id() == 'clang'
if cppCompiler.version() < '5.0.0'
warning('Clang v' + cppCompiler.version() + ' doesn\'t fully support C++17.')
minVersion = '6.0.0'

if cppCompiler.version() < minVersion
warning('Clang v' + cppCompiler.version() + ' is not supported. Minimum version is ' + minVersion)
endif
llvmIncludesDir += join_paths('include', 'llvm')

# use LLVM linker if available
llvmLinker = find_program('lld-6.0', 'lld-5.0', 'lld', required : false)
llvmLinker = find_program('lld-7', 'lld-6.0', 'lld', required : false)
if llvmLinker.found() == true
gLinkArgs += '-fuse-ld=' + llvmLinker.path().split('/')[-1]
endif
Expand All @@ -44,11 +46,18 @@ if build_machine.system() == 'linux'
'-pthread',
]
endif
gLinkArgs += '-lc++experimental'

if (cppCompiler.version() >= '7.0.0')
gLinkArgs += '-lc++fs'
else
gLinkArgs += '-lc++experimental'
endif

elif cppCompiler.get_id() == 'gcc'
if cppCompiler.version() < '7.0.0'
warning('GCC v' + cppCompiler.version() + ' doesn\'t fully support C++17.')
minVersion = '7.0.0'

if cppCompiler.version() < minVersion
warning('GCC v' + cppCompiler.version() + ' is not supported. Minimum version is ' + minVersion)
endif

if get_option('linktype') == 'static'
Expand Down Expand Up @@ -170,4 +179,4 @@ includeDirs = include_directories(publicIncludesDir,
llvmIncludesDir,
'.') #build directory

subdir('src')
subdir('src')
4 changes: 2 additions & 2 deletions src/spmod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

#if __has_include(<filesystem>)
#include <filesystem>
// As of GCC 8.1 filesystem is no longer part of experimental
#if defined SP_GCC && __GNUC__ >= 8
// As of GCC 8.1 and Clang 7 filesystem is no longer part of experimental
#if (defined SP_GCC && __GNUC__ >= 8) || (defined SP_CLANG && __clang_major__ >= 7)
namespace fs = std::filesystem;
#else // Some compilers still have filesystem within experimental namespace like MSVC
namespace fs = std::experimental::filesystem;
Expand Down
2 changes: 1 addition & 1 deletion travis/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
mkdir -p build
cd build
python /usr/bin/meson .. . --buildtype release --warnlevel 3 -D linktype=$LINK_TYPE
python /usr/bin/meson .. . --buildtype release --warnlevel 3 -D linktype=$LINK_TYPE -D b_lto=true
python /usr/bin/meson configure
ninja -v
17 changes: 14 additions & 3 deletions travis/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ XZ_OPT="-9e --threads=0"
mkdir dlls

# Install ambuild
git clone https://github.com/alliedmodders/ambuild.git ../ambuild
git clone --depth=1 https://github.com/alliedmodders/ambuild.git ../ambuild

# Patch to build sourcepawn lib without -g3 switch (Clang only)
if [[ $CLANG_VERSION ]]
Expand All @@ -31,12 +31,23 @@ cd $TRAVIS_BUILD_DIR
# Move SPMod lib to dlls
mv build/src/libspmod_mm.so dlls

if [[ $TRAVIS_TAG ]]
then
ARCHIVE_NAME=spmod-$TRAVIS_OS_NAME-$TRAVIS_TAG-$CC$CC_VERSION-$LINK_TYPE.tar.xz
else
ARCHIVE_NAME=spmod-$TRAVIS_OS_NAME-$COMMIT_NUM-$COMMIT_SHORT_SHA-$CC$CC_VERSION-$LINK_TYPE.tar.xz
fi

if [[ $LINK_TYPE == "dynamic" && ! -z $CLANG_VERSION ]]
then
mkdir libs
mv build/libc++abi.so.1 libs
mv build/libc++.so.1 libs
tar -cJvf spmod-$TRAVIS_OS_NAME-$TRAVIS_TAG-$CC$CC_VERSION-$LINK_TYPE.tar.xz dlls scripts libs

tar -cJvf $ARCHIVE_NAME dlls scripts libs
else
tar -cJvf spmod-$TRAVIS_OS_NAME-$TRAVIS_TAG-$CC$CC_VERSION-$LINK_TYPE.tar.xz dlls scripts
tar -cJvf $ARCHIVE_NAME dlls scripts
fi

mkdir upload
mv $ARCHIVE_NAME upload
20 changes: 10 additions & 10 deletions travis/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
if [[ ! -z "${CLANG_VERSION}" ]]
then
# Overwrite default compiler
if [ ${CLANG_VERSION} == 5 ]
then
export LDFLAGS=-fuse-ld=lld-5.0
BRANCH_NAME=release_50

CLANG_COMPILER=/usr/bin/clang-5.0
CLANGPP_COMPILER=/usr/bin/clang++-5.0
elif [ ${CLANG_VERSION} == 6 ]
if [ ${CLANG_VERSION} == 6 ]
then
export LDFLAGS=-fuse-ld=lld-6.0
BRANCH_NAME=release_60

CLANG_COMPILER=/usr/bin/clang-6.0
CLANGPP_COMPILER=/usr/bin/clang++-6.0
elif [ ${CLANG_VERSION} == 7 ]
then
export LDFLAGS=-fuse-ld=lld-7
BRANCH_NAME=release_70

CLANG_COMPILER=/usr/bin/clang-7
CLANGPP_COMPILER=/usr/bin/clang++-7
fi

sudo update-alternatives --install /usr/bin/clang clang ${CLANG_COMPILER} 1000
sudo update-alternatives --install /usr/bin/clang++ clang++ ${CLANGPP_COMPILER} 1000

# Build libcxxabi & libcxx
git clone -b ${BRANCH_NAME} https://github.com/llvm-mirror/libcxx.git ../libcxx
git clone -b ${BRANCH_NAME} https://github.com/llvm-mirror/libcxxabi.git ../libcxxabi
git clone --depth=1 -b ${BRANCH_NAME} https://github.com/llvm-mirror/libcxx.git ../libcxx
git clone --depth=1 -b ${BRANCH_NAME} https://github.com/llvm-mirror/libcxxabi.git ../libcxxabi
mkdir ../libcxx_build ../libcxxabi_build
cd ../libcxxabi_build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-m32 -DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include ../libcxxabi/
Expand Down

0 comments on commit 477a2b1

Please sign in to comment.