Open ThisNekoGuy opened 1 year ago
Hi, building with EOS isn't possible for other users due to restrictions around the SDK.
If you do get a copy the Steamworks SDK, then the build scripts pass something along the lines of
export STEAMWORKS_ROOT="../dependencies" export STEAMWORKS_ENABLED=1
to locate the SDK directory when building.
But why the encrypted zip file(s) and are they necessary? If so, where are the encryption keys...?
The encrypted zips are necessary because the Epic SDK is under a restrictive license (and originally the Steamworks SDK was too - but it seems to be publicly available now).
In any case, you don't need it to build a DRM-free build.
If I remember correctly, the libs you need to build are: physfs, SDL2, SDL2_image, SDL2_net, SDL2_ttf, libpng (and thus libz), and ... that may be all.
Use cmake to create a project for your preferred environment, and make sure STEAMWORKS_ENABLED and EOS_ENABLED are both false (easy to configure with an IDE, or I think you can pass -DSTEAMWORKS_ENABLED=0 in a terminal). You may need to finagle things a bit further to get it to build, but I'm happy to answer any additional direct questions here.
Lastly: consider if you want to build off of the latest-and-greatest "quality-of-death" beta version (we keep this code in the develop
branch) or whether you just want to build off of the "old" master
branch that hasn't been updated in a few years. I would recommend the former personally, but it's your choice.
Best of luck.
@SheridanR
In any case, you don't need it to build a DRM-free build.
To be clear, I was under the impression that Steamworks was necessary for multiplayer compatibility with Steam users (since all my friends use Steam)
I would recommend the former personally, but it's your choice.
I'll do that, thanks for letting me know :ok_hand:
Can I get some helping understanding what the STEAMWORKS_INCLUDE_DIR
and STEAMWORKS_LIBRARIES
variables are supposed to be set to?
This is what I currently have them set to and it's throwing build errors because Clang can't find the Steam API headers for some reason:
if [ "$(uname -m)" == "x86_64" ] || [ "$(uname -m)" == "x86" ] || [ "$(uname -m)" == "i686" ]; then
export STEAMWORKS_ENABLED=1
export STEAMWORKS_ROOT="/opt/steamworks-sdk"
export STEAMWORKS_INCLUDE_DIR="${STEAMWORKS_ROOT}/public/steam/"
if [ "$(uname -m)" == "x86_64" ]; then
export STEAMWORKS_LIBRARIES="${STEAMWORKS_ROOT}/public/steam/lib/linux64"
elif [ "$(uname -m)" == "x86" ] || [ "$(uname -m)" == "i686" ]; then
export STEAMWORKS_LIBRARIES="${STEAMWORKS_ROOT}/public/steam/lib/linux32"
fi
else
export STEAMWORKS_ENABLED=0
fi
The include dir should terminate at the public directory, not steam.
For some reason, building without FMODex (INSTALL.md
claims FMOD is deprecated?) and with OpenAL throws FMOD errors at build-time?
And building with FMODex produces these errors late in the build:
Any idea why these are errors? The last CI didn't seem to indicate these were build issues :/
~~I made 4 FMOD-build patches to try to address the argument errors as much as I could (considering I'm not exactly familiar with this code-base) but linking seems to fail: build.log~~ Seems I needed the fmodstudioapi package from the site; now I get a confusing issue where cmake just doesn't want to believe me where I tell it the include directory is... :woozy_face: So it fails far earlier now and I have no idea what I'm doing wrong:
As for the OpenAL build errors, I imagine what's needed to fix them might be a bit more substancial... I'm not sure when these errors were introduced though, given that I thought that it's supposed to be the same build "tag" (if there was one) as 3.8.6 and the Steam version obviously doesn't lack audio :/
@WALLOFJUSTICE The export and cmake values are correctly set, so I don't see why it wouldn't find fmod.hpp
?
Faced the same errors and was able to compile in the end with some modifications.
1) compiled without sound by modifying a little bit CMake files and few lines in the source code, I'm testing it by doing real runs, pushing a PR to enable this https://github.com/TurningWheel/Barony/pull/823 2) Tested to compile with OpenAL, it's broken today sadly, 3) will try to get FMOD and try with it
@WALLOFJUSTICE @ThisNekoGuy would appreciate feedback on the PR.
I'm trying to better understand the Barony build process given some oddities and missing information I've seen around the repo that's made it difficult for me to build the project.
Typically when I do this sort of thing, I use the Arch Build System to break the process into steps (via bash) and potentially package the end-result as a Arch system package; for those unfamiliar, this is how the AUR is driven.
My main issues are that there's discrepancies and/or missing information about how the project is built with that intent and how the project is built with Steamworks and EOS support when somehow encrypted zip files are used (referring to the build-linux_fmod_steam_eos-barony.sh CI) where there are no encryption keys anywhere in this repository to build this thing, as far as I'm aware. That said, the other files that vaguely describe this to me are INSTALL.md and CMakeLists.txt references to EOS environment variables?
Below you can find the steps I've taken; I've made comments in inside of the
prepare()
,build()
, andpackage()
functions in regards to the issues I'm facing and I'm hoping I can get some advice about the right way to go about this. I'm a junior C# dev, so this C/C++ sort of thing doesn't quite immediately make sense to mePKGBUILD file:
```bash pkgname=barony pkgver=3.3.7 pkgrel=0 pkgdesc='A first-person roguelike RPG featuring permadeath, hunger, and exploration in procedurally generated dungeons.' arch=('any') url=https://github.com/TurningWheel/${pkgname/b/B/} makedepends=('git' 'make' 'cmake' 'sed' 'grep' 'physfs' 'sdl2' 'sdl2_image' 'sdl2_net' 'sdl2_ttf' 'libpng' 'zlib' 'rapidjson' 'base-devel' 'clang' 'llvm' 'llvm-libs' 'lld' 'gold') depends=('glibc' 'libc++abi') optdepends=('') license=('custom:BaronyOpenSource' 'custom:TheFreeTypeProject' 'zlib' 'MIT:RapidJSON') source=("git+${url}.git" "Barony.desktop") sha256sums=('SKIP' 'de79df4e66f127e16609b33d591f9322b4bb11ae42bc3ace2fa97e400385f46b') options=('!strip' 'staticlibs' 'debug') ## Use this if you prefer opendoas; the benefit here is that doas won't time out on you if you wait too long to authenticate after compilation if [ -f /usr/bin/doas ] && [ -f /etc/doas.conf ]; then PACMAN_AUTH=(doas) fi USE_CLANG=1 # Default installation directory. Can be useful if you do not have a lot of space on the default storage drive # DON'T put a "/" at the start of the path!! #_install_dir="opt/${pkgname}" ## This is for detecting your CPU architecture automatically; set to false if you want to enforce your own makepkg.conf file ## Disabled by default as a compromise for those bothered by having it force-enabled ## Note: the resulting package will still be named containing "x86_64" unless the build was done with an "official" Arch distro for that architecture (like Arch ARM - [don't exactly advise using Arch ARM though]) ## or if you manage to trick your Arch installation to accept other architecture extensions by fiddling with the $CARCH variable and /etc/pacman.conf - this method has flaws, namely due to a bug: ## it doesn't work with "makechrootpkg" - though # Valid values are false / disabled / default, auto, and native # "false" means the values for these will respect your /etc/makepkg.conf arch_auto=false if [[ ${arch_auto} == auto ]] then ## Architecture checks and compile flag adjustments - shellcheck throws a fit about the build function but it looks fine to me; checks for the highest available x64 support level and falls back to "native" if either not available if [ "$(uname -m)" == "x86_64" ]; then if [ "$(/lib/ld-linux-x86-64.so.2 --help | grep -w 'x86-64-v4' | cut -d ',' -f 1 | sed 's/^ //' | sed 's/ (/ - /')" == 'x86-64-v4 - supported' ]; then export CFLAGS="${CFLAGS} -march=x86-64-v4 -mtune=x86-64-v4" export LDFLAGS="-Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now" elif [ "$(/lib/ld-linux-x86-64.so.2 --help | grep -w 'x86-64-v3' | cut -d ',' -f 1 | sed 's/^ //' | sed 's/ (/ - /')" == 'x86-64-v3 - supported' ]; then export CFLAGS="${CFLAGS} -march=x86-64-v3 -mtune=x86-64-v3" export LDFLAGS="-Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now" elif [ "$(/lib/ld-linux-x86-64.so.2 --help | grep -w 'x86-64-v2' | cut -d ',' -f 1 | sed 's/^ //' | sed 's/ (/ - /')" == 'x86-64-v2 - supported' ]; then export CFLAGS="${CFLAGS} -march=x86-64-v2 -mtune=x86-64-v2" export LDFLAGS="-Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now" elif [ "$(/lib/ld-linux-x86-64.so.2 --help | grep 'x86_64' | grep 'supported' | cut -d ',' -f 1 | sed 's/^ //' | sed 's/ (/ - /' | grep -w '^x86_64 - supported')" == 'x86_64 - supported' ]; then export CFLAGS="${CFLAGS} -march=x86-64 -mtune=x86-64" fi elif [ "$(uname -m)" == "aarch64" ]; then export CFLAGS="${CFLAGS} -march=aarch64 -mtune=aarch64 -mcpu=native" export LDFLAGS="-Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now" elif [[ "${arch_auto}" == native ]]; then export CFLAGS="${CFLAGS} -march=native -mtune=native -mcpu=native" fi fi CFLAGS="${CFLAGS} -O3 -pipe -fno-plt -pthread -fsanitize=bounds,alignment,object-size -fsanitize-undefined-trap-on-error \ -fexceptions -minline-all-stringops -ftree-vectorize \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ -fstack-clash-protection -fstack-protector-strong -fcf-protection" export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS" export LDFLAGS="-unwind=libunwind -lpthread -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now" if [ ! "${USE_CLANG}" -eq 0 ] && [ -f /usr/bin/clang ]; then export CC=clang export CXX=clang++ export LD="" export AR="/usr/bin/llvm-ar" export NM="/usr/bin/llvm-nm" export AS="/usr/bin/llvm-as" export RANLIB="/usr/bin/llvm-ranlib" export STRIP="/usr/bin/llvm-strip" export OBJCOPY="/usr/bin/llvm-objcopy" CLANG_VERSION="$(clang --version | grep 'version' | sed 's|version ||' | cut -f 1 -d ' ' --complement | cut -f 1 -d '.')" if [ "${CLANG_VERSION}" -eq 16 ] || [ "${CLANG_VERSION}" -gt 16 ]; then export CFLAGS="${CFLAGS} -fstrict-flex-arrays" export CXXFLAGS="${CXXFLAGS} -fstrict-flex-arrays" fi export LDFLAGS="-stdlib=libstdc++ -lc++abi -fuse-ld=lld ${LDFLAGS}" ## This value is for Arch users, in case it's not familiar to those who read this export LTOFLAGS="-flto=full" export DEBUG_CFLAGS="-g" else export CC=gcc export CXX=g++ export LD="" export AR="/usr/bin/gcc-ar" export NM="/usr/bin/gcc-nm" export AS="/usr/bin/as" export RANLIB="/usr/bin/gcc-ranlib" export STRIP="/usr/bin/strip" export OBJCOPY="/usr/bin/objcopy" GCC_VERSION="$(gcc --version | grep '(GCC)' | sed 's|gcc (GCC) ||' | cut -f 1 -d ' ' | cut -f 1 -d '.')" if [ "${GCC_VERSION}" -eq 13 ] || [ "${GCC_VERSION}" -gt 13 ]; then export CFLAGS="${CFLAGS} -fstrict-flex-arrays" export CXXFLAGS="${CXXFLAGS} -fstrict-flex-arrays" fi export LDFLAGS="-fuse-ld=gold ${LDFLAGS}" ## This value is for Arch users, in case it's not familiar to those who read this export LTOFLAGS="-flto -fuse-linker-plugin" export DEBUG_CFLAGS="-g -fvar-tracking-assignments" fi export DEBUG_CXXFLAGS="${DEBUG_CFLAGS}" prepare() { cd "${srcdir}/${pkgname}" || return CURRENT_CLONED_VERSION="$(git describe --tags)" if [ "${CURRENT_CLONED_VERSION}" != "${pkgver}" ]; then cd .. rm -rf "${pkgname}" git clone --depth=1 --branch=${pkgver} "${url}" "${pkgname}" cd "${pkgname}" || return else rm -f .git/index.lock git fetch --depth=1 origin tag ${pkgver} git reset --hard ${pkgver} fi ## Official game files are supposedly needed in this directory to build the open-source project # required_files=('sound' 'models' 'maps' 'items' 'images' 'data' 'books' 'music') # # for folder in "${required_files[@]}"; do # if [ ! -d "${srcdir}/${pkgdir}/${folder}" ]; then # echo "ERROR: Required game files for \"${folder}\" are not present in project directory" # exit 1 # fi # done # OpenAL support is deprecated in favor of FMOD cmake -B build \ -DCMAKE_BUILD_TYPE=Release \ -DOPTIMIZATION_LEVEL="-O3" \ -DCMAKE_C_FLAGS_RELEASE="${CFLAGS}" \ -DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS}" \ -DCMAKE_C_FLAGS_DEBUG="${DEBUG_CFLAGS}" \ -DCMAKE_CXX_FLAGS_DEBUG="${DEBUG_CXXFLAGS}" \ -DGAME_ENABLED 1 \ -DEDITOR_ENABLED 1 \ -DFMOD_ENABLED=ON \ -DOPENAL_ENABLED=OFF \ -DSTEAMWORKS_ENABLED=1 \ -DEOS_ENABLED=0 ## Unknown variables for EOS that are required to enable it? # BUILD_ENV_PR # BUILD_ENV_SA # BUILD_ENV_DE # BUILD_ENV_CC # BUILD_ENV_CS # BUILD_ENV_GSE ## cmake values I should use? # Binaries: -DCMAKE_INSTALL_BINDIR # Libraries: -DCMAKE_INSTALL_LIBDIR # Data files: -DCMAKE_INSTALL_DATADIR # Documentation: -DCMAKE_INSTALL_DOCDIR # Install prefix: -DCMAKE_INSTALL_PREFIX make } ## Incomplete; needs to be reviewed build() { cd "${srcdir}/${pkgname}" || return make -C build if [ -f "barony.x86_64" ] && [ "$(uname -m)" != "x86_64" ]; then mv "barony.x86_64" "barony.$(uname -m)" fi } ## Incomplete; needs work package() { # Desktop entry cp Barony.desktop Barony.desktop.bak sed -i "5c\Exec=/usr/bin/barony.$(uname -m) %U" Barony.desktop sed -i "12c\Path=/usr/bin/" Barony.desktop install -Dm755 Barony.desktop "${pkgdir}/usr/share/applications/Barony.desktop" chmod +x "${pkgdir}/usr/share/applications/Barony.desktop" cd "${srcdir}/${pkgname}" || return ## Needs to be reviewed to make sure it gets packaged correctly # install -dm755 "/usr/bin" install -dm755 "Barony_Icon256x256.png" "/usr/share/pixmaps/" install -dm755 "BaronyEditor_Icon256x256.png" "/usr/share/pixmaps/" install -dm755 ../../Barony.desktop "/usr/share/applications/" mv ../../Barony.desktop.bak ../../Barony.desktop # License mkdir -p "/usr/share/licenses/${pkgname}/" install -Dm644 LICENSE.txt "/usr/share/licenses/${pkgname}/LICENSE.txt" install -Dm644 README-SDL.txt "/usr/share/licenses/${pkgname}/README-SDL.txt" install -Dm644 LICENSE.SDL2_ttf.txt "/usr/share/licenses/${pkgname}/LICENSE.SDL2_ttf.txt" install -Dm644 LICENSE.freetype.txt "/usr/share/licenses/${pkgname}/LICENSE.freetype.txt" install -Dm644 LICENSE.zlib.txt "/usr/share/licenses/${pkgname}/LICENSE.zlib.txt" ## Not complete; needs advice cd build || return make install "${pkgdir}" } ```