Skip to content

Commit 8362c2d

Browse files
authored
Create a new release build for linux_x64. (shader-slang#3989)
1 parent beae3a9 commit 8362c2d

File tree

5 files changed

+97
-1
lines changed

5 files changed

+97
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ubuntu:18.04
2+
RUN apt update
3+
RUN apt install -y software-properties-common wget git build-essential zip libx11-dev zlib1g-dev
4+
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y
5+
RUN apt update
6+
RUN apt install -y gcc-9 g++-9
7+
RUN update-alternatives \
8+
--install /usr/bin/gcc gcc /usr/bin/gcc-9 100 \
9+
--slave /usr/bin/g++ g++ /usr/bin/g++-9 \
10+
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 \
11+
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-9 \
12+
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9 \
13+
--slave /usr/bin/gcov gcov /usr/bin/gcov-9 \
14+
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-9 \
15+
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: Linux Release
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v2
14+
with:
15+
submodules: 'true'
16+
fetch-depth: '0'
17+
18+
- name: build docker image
19+
run: docker build -t ubuntu-18.04-gcc-9 ./.github/workflows/dockerfiles/ubuntu-18.04-x64
20+
21+
# build the binary in docker image
22+
- name: Run the build process with Docker
23+
uses: addnab/docker-run-action@v3
24+
with:
25+
image: ubuntu-18.04-gcc-9
26+
options: -v ${{ github.workspace }}:/home/app
27+
run: |
28+
cd /home/app
29+
git config --global --add safe.directory /home/app
30+
export CC=gcc
31+
export CONFIGURATION=release
32+
export ARCH=x64
33+
export TARGETARCH=x64
34+
export TARGETARCH=x64
35+
export GLIBC_COMPATIBLE=1
36+
/bin/bash ./github_build.sh
37+
38+
- name: CreatePackages
39+
id: build
40+
run: |
41+
echo "creating binary archieves..."
42+
export SLANG_OS_NAME=linux
43+
export SLANG_ARCH_NAME=`uname -p`
44+
export TAG_NAME=`git describe --tags`
45+
export SLANG_TAG=${TAG_NAME#v}
46+
echo "tag:$TAG_NAME"
47+
echo "slang-tag:$SLANG_TAG"
48+
export SLANG_BINARY_ARCHIVE=slang-${SLANG_TAG}-${SLANG_OS_NAME}-${SLANG_ARCH_NAME}-glibc-2.27.zip
49+
export SLANG_BINARY_ARCHIVE_TAR=slang-${SLANG_TAG}-${SLANG_OS_NAME}-${SLANG_ARCH_NAME}-glibc-2.27.tar.gz
50+
echo "creating zip"
51+
zip -r ${SLANG_BINARY_ARCHIVE} bin/*/*/slangc bin/*/*/slangd bin/*/*/libslang.so bin/*/*/libslang-glslang.so bin/*/*/libgfx.so bin/*/*/libslang-llvm.so docs/*.md README.md LICENSE slang.h slang-com-helper.h slang-com-ptr.h slang-tag-version.h slang-gfx.h prelude/*.h
52+
echo "creating tar"
53+
tar -czf ${SLANG_BINARY_ARCHIVE_TAR} bin/*/*/slangc bin/*/*/slangd bin/*/*/libslang.so bin/*/*/libslang-glslang.so bin/*/*/libgfx.so bin/*/*/libslang-llvm.so docs/*.md README.md LICENSE slang.h slang-com-helper.h slang-com-ptr.h slang-tag-version.h slang-gfx.h prelude/*.h
54+
echo "SLANG_BINARY_ARCHIVE=${SLANG_BINARY_ARCHIVE}" >> $GITHUB_OUTPUT
55+
echo "SLANG_BINARY_ARCHIVE_TAR=${SLANG_BINARY_ARCHIVE_TAR}" >> $GITHUB_OUTPUT
56+
- name: UploadBinary
57+
uses: softprops/action-gh-release@v1
58+
with:
59+
files: |
60+
${{ steps.build.outputs.SLANG_BINARY_ARCHIVE }}
61+
${{ steps.build.outputs.SLANG_BINARY_ARCHIVE_TAR }}
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deps/target-deps.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"windows-x86_64" : { "type" : "url", "path" : "windows-x64-release.zip" },
2424
"windows-x86" : { "type": "url", "path" : "windows-win32-release.zip" },
2525
"linux-x86_64" : { "type": "url", "path" : "linux-x64-release.zip" },
26+
"linux-x86_64-glibc-2.27" : { "type": "url", "path" : "linux-x64-release-glibc-2.27.zip" },
2627
"linux-x86" : { "type": "url", "path" : "linux-x86-release.zip" },
2728
"macosx-x86_64" : { "type": "url", "path" : "macosx-x86_64-release.zip" },
2829
"windows-aarch64" : { "type" : "url", "path" : "windows-aarch64-release.zip" }

github_build.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ if [[ "aarch64" == "${TARGETARCH}" && "release" == "${CONFIGURATION}" ]]; then
2020
glslangBuildFlag="--build-glslang=true"
2121
fi
2222

23+
if [[ ! -z ${GLIBC_COMPATIBLE} ]]; then
24+
glibcCompatible="--glibcForwardCompatible=true"
25+
fi
26+
2327
if [[ "${ARCH}" != "${TARGETARCH}" ]]; then
2428

2529
# Create the makefile
@@ -35,7 +39,7 @@ rm -rf ./bin
3539

3640
else
3741
# Create the makefile
38-
./premake5 gmake2 --cc=${CC} --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --no-progress=true ${glslangBuildFlag}
42+
./premake5 gmake2 --cc=${CC} --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --no-progress=true ${glslangBuildFlag} ${glibcCompatible}
3943
fi
4044

4145
# Build the configuration

premake5.lua

+13
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@ newoption {
236236
allowed = { { "true", "True"}, { "false", "False" } }
237237
}
238238

239+
newoption {
240+
trigger = "glibc-forward-compatible",
241+
description = "(Optional) Build slang against older version of glibc (2.27) to be forward compatible with older systems",
242+
value = "bool",
243+
default = "false",
244+
allowed = { { "true", "True"}, { "false", "False" } }
245+
}
246+
239247
buildLocation = _OPTIONS["build-location"]
240248
executeBinary = (_OPTIONS["execute-binary"] == "true")
241249
buildGlslang = (_OPTIONS["build-glslang"] == "true")
@@ -254,6 +262,7 @@ enableAsan = (_OPTIONS["enable-asan"] == "true")
254262
dxOnVk = (_OPTIONS["dx-on-vk"] == "true")
255263
enableAftermath = (_OPTIONS["enable-aftermath"] == "true")
256264
defaultSPIRVDirect = (_OPTIONS["default-spirv-direct"] == "true")
265+
glibcForwardCompatible = (_OPTIONS["glibc-forward-compatible"] == "true")
257266

258267
-- If stdlib embedding is enabled, disable stdlib source embedding by default
259268
disableStdlibSource = enableEmbedStdLib
@@ -278,6 +287,10 @@ end
278287

279288
targetInfo = slangUtil.getTargetInfo()
280289

290+
printf("target name " .. targetInfo.name)
291+
if (targetInfo.name == "linux-x86_64") and (glibcForwardCompatible) then
292+
targetInfo.name = targetInfo.name .. "-glibc-2.27"
293+
end
281294
--
282295
-- Update the dependencies for the target
283296
--

0 commit comments

Comments
 (0)