Skip to content

Commit

Permalink
Add missing packages for full functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
RyeMutt committed Oct 22, 2024
1 parent c5fe8af commit 37dbbbb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 164 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,26 @@ jobs:
build:
strategy:
matrix:
os: [windows-2022, macos-12, ubuntu-22.04]
os: [windows-2022, macos-14, ubuntu-22.04]
addrsize: ["64"]
runs-on: ${{ matrix.os }}
steps:
- name: Update apt
if: runner.os == 'Linux'
run: sudo apt update

- name: Setup Linux Build Dependencies
if: runner.os == 'Linux'
run: >
sudo apt install -y mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
libxext-dev libibus-1.0-dev
fcitx-libs-dev libudev-dev libunwind-dev
libwayland-dev libxkbcommon-dev libpulse-dev ninja-build
if: runner.os == 'linux'
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt update
sudo apt install -y \
mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev libvulkan-dev \
libxext-dev libxrandr-dev libxfixes-dev libxcursor-dev libxss-dev libxi-dev libxkbcommon-dev \
libwayland-dev libdecor-0-dev libdbus-1-dev libibus-1.0-dev fcitx-libs-dev \
libudev-dev libunwind-dev libdirectfb-dev libasound2-dev libpulse-dev \
libpipewire-0.3-dev ninja-build
- name: Setup macOS Build Dependencies
if: ${{ runner.os == 'macOS' }}
run: brew install ninja

- name: Setup Windows Build Dependencies
if: ${{ runner.os == 'Windows' }}
run: choco install ninja

- name: Build with autobuild
uses: secondlife/action-autobuild@v4
Expand Down
2 changes: 0 additions & 2 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<key>manifest</key>
<array>
<string>lib/release/*.*</string>
<string>lib/debug/*.*</string>
</array>
<key>name</key>
<string>darwin64</string>
Expand All @@ -85,7 +84,6 @@
<key>manifest</key>
<array>
<string>lib/release/*.so*</string>
<string>lib/debug/*.so*</string>
</array>
<key>name</key>
<string>linux64</string>
Expand Down
159 changes: 12 additions & 147 deletions build-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ source_environment_tempfile="$stage/source_environment.sh"
"$autobuild" source_environment > "$source_environment_tempfile"
. "$source_environment_tempfile"

# remove_cxxstd
source "$(dirname "$AUTOBUILD_VARIABLES_FILE")/functions"

# Restore all .sos
restore_sos ()
{
Expand Down Expand Up @@ -83,200 +86,62 @@ case "$AUTOBUILD_PLATFORM" in
;;
darwin*)
# Setup osx sdk platform
SDKNAME="macosx"
export SDKROOT=$(xcodebuild -version -sdk ${SDKNAME} Path)
export MACOSX_DEPLOYMENT_TARGET=10.15
export MACOSX_DEPLOYMENT_TARGET="$LL_BUILD_DARWIN_DEPLOY_TARGET"

# Setup build flags
ARCH_FLAGS="-arch x86_64"
SDK_FLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -isysroot ${SDKROOT}"
DEBUG_COMMON_FLAGS="$ARCH_FLAGS $SDK_FLAGS -Og -g -msse4.2 -fPIC -DPIC"
RELEASE_COMMON_FLAGS="$ARCH_FLAGS $SDK_FLAGS -O3 -flto -g -msse4.2 -fPIC -DPIC -fstack-protector-strong"
DEBUG_CFLAGS="$DEBUG_COMMON_FLAGS"
RELEASE_CFLAGS="$RELEASE_COMMON_FLAGS"
DEBUG_CXXFLAGS="$DEBUG_COMMON_FLAGS -std=c++17"
RELEASE_CXXFLAGS="$RELEASE_COMMON_FLAGS -std=c++17"
DEBUG_CPPFLAGS="-DPIC"
RELEASE_CPPFLAGS="-DPIC"
DEBUG_LDFLAGS="$ARCH_FLAGS $SDK_FLAGS -Wl,-headerpad_max_install_names"
RELEASE_LDFLAGS="$ARCH_FLAGS $SDK_FLAGS -Wl,-headerpad_max_install_names"
opts="${TARGET_OPTS:--arch $AUTOBUILD_CONFIGURE_ARCH $LL_BUILD_RELEASE}"

mkdir -p "$stage/include/SDL2"
mkdir -p "$stage/lib/debug"
mkdir -p "$stage/lib/release"

PREFIX_DEBUG="$stage/temp_debug"
PREFIX_RELEASE="$stage/temp_release"

mkdir -p $PREFIX_DEBUG
mkdir -p $PREFIX_RELEASE

mkdir -p "build_debug"
pushd "build_debug"
CFLAGS="$DEBUG_CFLAGS" \
CXXFLAGS="$DEBUG_CXXFLAGS" \
CPPFLAGS="$DEBUG_CPPFLAGS" \
LDFLAGS="$DEBUG_LDFLAGS" \
cmake .. -GNinja -DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_C_FLAGS="$DEBUG_CFLAGS" \
-DCMAKE_CXX_FLAGS="$DEBUG_CXXFLAGS" \
-DCMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL="0" \
-DCMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH=NO \
-DCMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS=YES \
-DCMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym \
-DCMAKE_XCODE_ATTRIBUTE_LLVM_LTO=NO \
-DCMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING=YES \
-DCMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS=sse4.2 \
-DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD="c++17" \
-DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY="libc++" \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED="NO" \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED="NO" \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="" \
-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-DCMAKE_OSX_SYSROOT=${SDKROOT} \
-DCMAKE_MACOSX_RPATH=YES -DCMAKE_INSTALL_PREFIX=$PREFIX_DEBUG

cmake --build . --config Debug
cmake --install . --config Debug
popd

mkdir -p "build_release"
pushd "build_release"
CFLAGS="$RELEASE_CFLAGS" \
CXXFLAGS="$RELEASE_CXXFLAGS" \
CPPFLAGS="$RELEASE_CPPFLAGS" \
LDFLAGS="$RELEASE_LDFLAGS" \
cmake .. -GNinja -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_FLAGS="$RELEASE_CFLAGS" \
-DCMAKE_CXX_FLAGS="$RELEASE_CXXFLAGS" \
-DCMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL=3 \
-DCMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH=YES \
-DCMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS=YES \
-DCMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym \
-DCMAKE_XCODE_ATTRIBUTE_LLVM_LTO=YES \
-DCMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING=YES \
-DCMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS=sse4.2 \
-DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD="c++17" \
-DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY="libc++" \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED="NO" \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED="NO" \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="" \
-DCMAKE_C_FLAGS="$(remove_cxxstd $opts)" \
-DCMAKE_CXX_FLAGS="$opts" \
-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-DCMAKE_OSX_SYSROOT=${SDKROOT} \
-DCMAKE_MACOSX_RPATH=YES -DCMAKE_INSTALL_PREFIX=$PREFIX_RELEASE
-DCMAKE_MACOSX_RPATH=YES \
-DCMAKE_INSTALL_PREFIX=$PREFIX_RELEASE

cmake --build . --config Release
cmake --install . --config Release
popd

cp -a $PREFIX_RELEASE/include/SDL2/*.* $stage/include/SDL2

cp -a $PREFIX_DEBUG/lib/*.dylib* $stage/lib/debug
cp -a $PREFIX_DEBUG/lib/libSDL2maind.a $stage/lib/debug

cp -a $PREFIX_RELEASE/lib/*.dylib* $stage/lib/release
cp -a $PREFIX_RELEASE/lib/libSDL2main.a $stage/lib/release

pushd "${stage}/lib/debug"
fix_dylib_id "libSDL2d.dylib"
strip -x -S libSDL2d.dylib
popd

pushd "${stage}/lib/release"
fix_dylib_id "libSDL2.dylib"
strip -x -S libSDL2.dylib
popd
;;
linux*)
# Linux build environment at Linden comes pre-polluted with stuff that can
# seriously damage 3rd-party builds. Environmental garbage you can expect
# includes:
#
# DISTCC_POTENTIAL_HOSTS arch root CXXFLAGS
# DISTCC_LOCATION top branch CC
# DISTCC_HOSTS build_name suffix CXX
# LSDISTCC_ARGS repo prefix CFLAGS
# cxx_version AUTOBUILD SIGN CPPFLAGS
#
# So, clear out bits that shouldn't affect our configure-directed build
# but which do nonetheless.
#
unset DISTCC_HOSTS CC CXX CFLAGS CPPFLAGS CXXFLAGS

# Default target per autobuild build --address-size
opts="${TARGET_OPTS:--m64}"
DEBUG_COMMON_FLAGS="$opts -Og -g -fPIC -DPIC"
RELEASE_COMMON_FLAGS="$opts -O3 -g -fPIC -DPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2"
DEBUG_CFLAGS="$DEBUG_COMMON_FLAGS"
RELEASE_CFLAGS="$RELEASE_COMMON_FLAGS"
DEBUG_CXXFLAGS="$DEBUG_COMMON_FLAGS -std=c++17"
RELEASE_CXXFLAGS="$RELEASE_COMMON_FLAGS -std=c++17"
DEBUG_CPPFLAGS="-DPIC"
RELEASE_CPPFLAGS="-DPIC"
opts="${TARGET_OPTS:--m$AUTOBUILD_ADDRSIZE $LL_BUILD_RELEASE}"

mkdir -p "$stage/include/SDL2"
mkdir -p "$stage/lib/debug"
mkdir -p "$stage/lib/release"

PREFIX_DEBUG="$stage/temp_debug"
PREFIX_RELEASE="$stage/temp_release"

mkdir -p $PREFIX_DEBUG
mkdir -p $PREFIX_RELEASE

# Handle any deliberate platform targeting
if [ -z "${TARGET_CPPFLAGS:-}" ]; then
# Remove sysroot contamination from build environment
unset CPPFLAGS
else
# Incorporate special pre-processing flags
export CPPFLAGS="$TARGET_CPPFLAGS"
fi

# Force static linkage to libz by moving .sos out of the way
# (Libz is only packaging statics right now but keep this working.)
trap restore_sos EXIT
for solib in "${stage}"/packages/lib/{debug,release}/libz.so*; do
if [ -f "$solib" ]; then
mv -f "$solib" "$solib".disable
fi
done

mkdir -p "build_debug"
pushd "build_debug"
CFLAGS="$DEBUG_CFLAGS" \
CXXFLAGS="$DEBUG_CXXFLAGS" \
CPPFLAGS="$DEBUG_CPPFLAGS" \
cmake .. -GNinja -DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_C_FLAGS="$DEBUG_CFLAGS" \
-DCMAKE_CXX_FLAGS="$DEBUG_CXXFLAGS" \
-DCMAKE_INSTALL_PREFIX=$PREFIX_DEBUG

cmake --build . --config Debug
cmake --install . --config Debug
popd

mkdir -p "build_release"
pushd "build_release"
CFLAGS="$RELEASE_CFLAGS" \
CXXFLAGS="$RELEASE_CXXFLAGS" \
CPPFLAGS="$RELEASE_CPPFLAGS" \
cmake .. -GNinja -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_FLAGS="$RELEASE_CFLAGS" \
-DCMAKE_CXX_FLAGS="$RELEASE_CXXFLAGS" \
-DCMAKE_C_FLAGS="$(remove_cxxstd $opts)" \
-DCMAKE_CXX_FLAGS="$opts" \
-DCMAKE_INSTALL_PREFIX=$PREFIX_RELEASE

cmake --build . --config Release
cmake --install . --config Release
popd

cp -a $PREFIX_RELEASE/include/SDL2/*.* $stage/include/SDL2

cp -a $PREFIX_DEBUG/lib/*.so* $stage/lib/debug
cp -a $PREFIX_DEBUG/lib/libSDL2maind.a $stage/lib/debug

cp -a $PREFIX_RELEASE/lib/*.so* $stage/lib/release
cp -a $PREFIX_RELEASE/lib/libSDL2main.a $stage/lib/release
;;
Expand Down

0 comments on commit 37dbbbb

Please sign in to comment.