Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backdoored-liblzma issue on 0.8.x #853

Merged
merged 11 commits into from
May 3, 2024
68 changes: 31 additions & 37 deletions .github/workflows/Windows-CI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# This is a basic workflow to help you get started with Actions

name: Windows-CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:

Expand Down Expand Up @@ -32,69 +29,66 @@ jobs:
build-type: Debug

env:
buildDir: '${{ github.workspace }}/build/'
# Indicates the location of vcpkg
VCPKG_ROOT: '${{ github.workspace }}/v'
# Tells vcpkg where binary packages are stored.
VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache'
## Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
#VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
VCPKG_BINARY_SOURCES: 'x-gha,readwrite'
VCPKG_DEFAULT_TRIPLET: x64-windows
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows
#PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3'

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
# for Binary Caching.
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 #v4.7.1
with:
python-version: '3.11.5'
check-latest: true

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3

- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1.0
with:
python-version: 3.11

- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash

- name: install-cmake
uses: lukka/get-cmake@4865386b66955d11be0abf8c112d0230023e742a #v3.27.9
uses: lukka/get-cmake@4931ab1fc1604964c055eb330edb3f6b26ba0cfa #v3.29.2
with:
cmakeVersion: 3.27.9
cmakeVersion: 3.29.2
ninjaVersion: 1.11.1

# # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# # when it is being run afterward by CMake.
# - name: restore-vcpkg
# uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
# with:
# # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
# path: |
# ${{ env.VCPKG_ROOT }}
# !${{ env.VCPKG_ROOT }}/buildtrees
# !${{ env.VCPKG_ROOT }}/packages
# !${{ env.VCPKG_ROOT }}/downloads
# !${{ env.VCPKG_ROOT }}/installed
# # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
# key: |
# ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# when it is being run afterward by CMake.
- name: restore-vcpkg
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2
with:
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ matrix.os }}-${{ hashFiles( './engine/vcpkg.json' )}}

- name: install-vcpkg
#if: steps.cache.outputs.cache-hit != 'true'
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/vegastrike/vcpkg-local.git ${{ env.VCPKG_ROOT }}
git clone https://github.com/Microsoft/vcpkg.git ${{ env.VCPKG_ROOT }}
${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics

- name: run-build-script
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/gh-actions-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ jobs:
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
allow_failure: false
- FROM: 'debian:buster'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
allow_failure: false
#- FROM: 'debian:buster'
# COMPILER: 'clang'
# USE_PYTHON_3: 'ON'
# OpenGL_GL_PREFERENCE: 'GLVND'
# allow_failure: false
- FROM: 'opensuse/leap:15.5'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
Expand Down Expand Up @@ -121,11 +121,11 @@ jobs:
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
allow_failure: false
- FROM: 'rockylinux/8.7'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
allow_failure: false
#- FROM: 'rockylinux/8.7'
# COMPILER: 'clang'
# USE_PYTHON_3: 'ON'
# OpenGL_GL_PREFERENCE: 'GLVND'
# allow_failure: false
- FROM: 'manjarolinux/base'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/gh-actions-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ jobs:
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
ARTIFACT_EXT: 'deb'
- FROM: 'debian:buster'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'LEGACY'
ARTIFACT_EXT: 'deb'
- FROM: 'debian:buster'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
ARTIFACT_EXT: 'deb'
#- FROM: 'debian:buster'
# COMPILER: 'clang'
# USE_PYTHON_3: 'ON'
# OpenGL_GL_PREFERENCE: 'LEGACY'
# ARTIFACT_EXT: 'deb'
#- FROM: 'debian:buster'
# COMPILER: 'clang'
# USE_PYTHON_3: 'ON'
# OpenGL_GL_PREFERENCE: 'GLVND'
# ARTIFACT_EXT: 'deb'
- FROM: 'opensuse/leap:15.5'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
Expand Down Expand Up @@ -156,16 +156,16 @@ jobs:
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
ARTIFACT_EXT: 'rpm'
- FROM: 'rockylinux:8.7'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'LEGACY'
ARTIFACT_EXT: 'rpm'
- FROM: 'rockylinux/8.7'
COMPILER: 'clang'
USE_PYTHON_3: 'ON'
OpenGL_GL_PREFERENCE: 'GLVND'
ARTIFACT_EXT: 'rpm'
#- FROM: 'rockylinux:8.7'
# COMPILER: 'clang'
# USE_PYTHON_3: 'ON'
# OpenGL_GL_PREFERENCE: 'LEGACY'
# ARTIFACT_EXT: 'rpm'
#- FROM: 'rockylinux/8.7'
# COMPILER: 'clang'
# USE_PYTHON_3: 'ON'
# OpenGL_GL_PREFERENCE: 'GLVND'
# ARTIFACT_EXT: 'rpm'

steps:
#- name: Set up Python
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,3 @@ jobs:
MY_OS_NAME: macos
FLAGS: '-DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_FIND_APPBUNDLE=LAST'
run: script/cibuild $FLAGS

# - name: Test
# working-directory: ${{github.workspace}}/build
# env:
# GTEST_OUTPUT: xml
# GTEST_COLOR: 1
# run: ctest -V
#
# - name: Upload test results
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce #v3.1.2
# if: failure()
# with:
# name: test_results_xml
# path: ${{github.workspace}}/build/test-results/**/*.xml
17 changes: 11 additions & 6 deletions engine/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,17 @@
"displayName": "Windows Default",
"description": "Default build for Windows",
"environment": {
"VCPKG_DEFAULT_TRIPLET": "x64-windows",
"VCPKG_DEFAULT_HOST_TRIPLET": "x64-windows",
"VCPKG_TARGET_TRIPLET": "x64-windows",
"VCPKG_HOST_TRIPLET": "x64-windows"
"VCPKG_TARGET_TRIPLET": "x64-windows-win10",
"VCPKG_HOST_TRIPLET": "x64-windows-win10"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"VCPKG_TARGET_TRIPLET": "x64-windows-win10",
"VCPKG_HOST_TRIPLET": "x64-windows-win10"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"debug": {
"output": true,
"find": true
Expand Down Expand Up @@ -329,7 +334,7 @@
"hidden": true,
"inherits": "windows-default",
"displayName": "Ninja on Windows",
"generator": "Ninja",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand Down
6 changes: 6 additions & 0 deletions engine/custom-triplets/x64-windows-win10.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} /DBOOST_ALL_DYN_LINK /DBOOST_USE_WINAPI_VERSION=0x0A00 /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00")
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} /DBOOST_ALL_DYN_LINK /DBOOST_USE_WINAPI_VERSION=0x0A00 /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00")
6 changes: 1 addition & 5 deletions engine/vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
"default-registry": {
"kind": "git",
"baseline": "45c660987c371515ddcc5c355e7989c0d652b85f",
"repository": "https://github.com/vegastrike/vcpkg-local"
}
"overlay-triplets": [ "./custom-triplets" ]
}
55 changes: 29 additions & 26 deletions engine/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "vega-strike",
"version-string": "0.8.2",
"dependencies": [
"boost-python",
"boost-log",
"boost-date-time",
"boost-iostreams",
"boost-system",
"boost-filesystem",
"boost-thread",
"boost-chrono",
"boost-atomic",
"boost-assign",
"boost-program-options",
"expat",
"freeglut",
"libpng",
"libjpeg-turbo",
"libvorbis",
"openal-soft",
"opengl",
"opengl-registry",
"sdl1",
"zlib"
]
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "vega-strike",
"version-string": "0.8.2",
"builtin-baseline": "da4b78d35084ec4e9808aa02017028da03b8d2ab",
"dependencies": [
"boost-python",
"boost-log",
"boost-date-time",
"boost-iostreams",
"boost-system",
"boost-filesystem",
"boost-thread",
"boost-chrono",
"boost-atomic",
"boost-assign",
"boost-format",
"boost-program-options",
"egl-registry",
"expat",
"freeglut",
"libpng",
"libjpeg-turbo",
"libvorbis",
"openal-soft",
"opengl",
"openssl",
"sdl1",
"zlib"
]
}
42 changes: 27 additions & 15 deletions script/bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (C) 2021 Stephen G. Tuggy
# bootstrap.ps1

# Copyright (C) 2021-2024 Stephen G. Tuggy and other Vega Strike contributors

# https://github.com/vegastrike/Vega-Strike-Engine-Source

Expand All @@ -11,31 +13,41 @@

# Vega Strike is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
# along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.

# You can customize this directory location if desired, but it should be
# something very short. Otherwise, you will run into problems.
Set-Variable -Name VCKPG_PARENT_DIR -Value "C:\Projects"
Set-Variable -Name CMAKE_VERSION -Value "3.20.2"
param(
[String]$VCPKG_PARENT_DIR = "C:\Projects"
)

Set-Variable -Name CMAKE_VERSION -Value "3.29.2"

New-Item "$VCKPG_PARENT_DIR" -ItemType Directory -Force
Push-Location "$VCKPG_PARENT_DIR"
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
New-Item "$VCPKG_PARENT_DIR" -ItemType Directory -Force
Push-Location "$VCPKG_PARENT_DIR"
git clone https://github.com/vegastrike/vcpkg-local.git ./v
.\v\bootstrap-vcpkg.bat -disableMetrics

[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCKPG_PARENT_DIR\vcpkg", 'User')
[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCPKG_PARENT_DIR\v", 'User')
$env:VCPKG_ROOT = "$VCPKG_PARENT_DIR\v"

$path = [Environment]::GetEnvironmentVariable('PATH', 'User')
$newPath = $path + ";$VCKPG_PARENT_DIR\vcpkg\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin"
$newPath = $path + ";$VCPKG_PARENT_DIR\v\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin"
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
$env:PATH = $newPath

[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_TRIPLET', 'x64-windows', 'User')
[Environment]::SetEnvironmentVariable('PYTHONHOME', "$VCKPG_PARENT_DIR\vcpkg\packages\python3_x64-windows\tools\python3", 'User')
$triplet = 'x64-windows'
[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_TRIPLET', $triplet, 'User')
$env:VCPKG_DEFAULT_TRIPLET = $triplet
[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_HOST_TRIPLET', $triplet, 'User')
$env:VCPKG_DEFAULT_HOST_TRIPLET = $triplet

Pop-Location
$pythonHome = "$VCPKG_PARENT_DIR\v\packages\python3_x64-windows\tools\python3"
[Environment]::SetEnvironmentVariable('PYTHONHOME', $pythonHome, 'User')
$env:PYTHONHOME = $pythonHome

. refreshenv
Pop-Location
Loading