Skip to content

Commit

Permalink
Remove unnecessary duplicated native libs
Browse files Browse the repository at this point in the history
  • Loading branch information
eXpl0it3r committed May 18, 2024
1 parent 303a1b4 commit 426666b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 27 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: NuGet Release

on:
push:
branches:
- master
- 2.6.x
workflow_dispatch: {}
on: [push, workflow_dispatch]

concurrency:
group: nuget-${{github.ref}}
Expand Down
18 changes: 10 additions & 8 deletions tools/nuget/build.linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ cmake --build . --config Release
# STEP 5: Copy result to the NuGet folders #
# ======================================== #

SFMLMajorMinor="2.6"
CSFMLMajorMinor="2.6"

# Copies one SFML and CSFML module into the NuGet package
# The module name must be passed to this function as an argument, in lowercase
# This function then copies $SFMLLibDir/libsfml-(module).so and
Expand All @@ -137,14 +140,13 @@ copymodule()

mkdir -p "$OutDir"

# Note the wildcard at the end of the first argument
# We are copying every versioned file here, not just the .so
# (libsfml-audio.so, libsfml-audio.so.2, libsfml-audio.so.2.6, etc)
# This is needed because of the way linux searches for libraries based
# one their SONAME
cp "$SFMLLibDir/libsfml-$MODULE.so"* "$OutDir"

cp "$CSFMLLibDir/libcsfml-$MODULE.so" "$OutDir"
# We're only copying the version of the library with major.minor version
# (e.g. libsfml-graphics.so.2.6 or libcsfml-graphics.so.2.6)
# Because the NuGet package doesn't support symlinks: https://github.com/NuGet/Home/issues/10734
# SFML.Net references CSFML by the major.minor version
# CSFML references the SFML library by the major.minor version
cp "$SFMLLibDir/libsfml-$MODULE.so.$SFMLMajorMinor" "$OutDir"
cp "$CSFMLLibDir/libcsfml-$MODULE.so.$CSFMLMajorMinor" "$OutDir"
}

copymodule audio
Expand Down
21 changes: 8 additions & 13 deletions tools/nuget/build.macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,14 @@ copymodule()

mkdir -p "$OutDir"

# Note the wildcard at the end of the first argument
# We are copying every versioned file here, not just the .dylib
# (libsfml-audio.dylib, libsfml-audio.2.dylib, libsfml-audio.2.6.dylib, etc)
# This is needed because of the way macOS searches for libraries based
# one their SONAME
cp "$SFMLLibDir/libsfml-$MODULE."* "$OutDir"

cp "$CSFMLLibDir/libcsfml-$MODULE."* "$OutDir"

# Fix naming for expected filename
mv "$OutDir/libcsfml-$MODULE.dylib" "$OutDir/libcsfml-$MODULE"
mv "$OutDir/libcsfml-$MODULE.$CSFMLMajorMinor.dylib" "$OutDir/libcsfml-$MODULE.$CSFMLMajorMinor"
mv "$OutDir/libcsfml-$MODULE.$CSFMLMajorMinorPatch.dylib" "$OutDir/libcsfml-$MODULE.$CSFMLMajorMinorPatch"
# We're only copying the version of the library with major.minor version
# (e.g. libsfml-graphics.2.6.dylib or libcsfml-graphics.2.6.dylib)
# Because the NuGet package doesn't support symlinks: https://github.com/NuGet/Home/issues/10734
# SFML.Net references CSFML by the major.minor version
# CSFML references the SFML library by the major.minor version via rpath
# Additionally, SFML.Net somehow can't handle the .dylib extension correctly, as such we remove it
cp "$SFMLLibDir/libsfml-$MODULE.$SFMLMajorMinor.dylib" "$OutDir/libsfml-$MODULE.$SFMLMajorMinor.dylib"
cp "$CSFMLLibDir/libcsfml-$MODULE.$CSFMLMajorMinor.dylib" "$OutDir/libcsfml-$MODULE.$CSFMLMajorMinor"
}

copymodule audio
Expand Down

0 comments on commit 426666b

Please sign in to comment.