Skip to content

Commit

Permalink
chore: Build libsodium with -fPIC for relocatable symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jan 27, 2025
1 parent 3b16a13 commit 84aa6d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion qtox/build_opus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "opus" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "opus" --supported "linux-aarch64 linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$LIB_TYPE" = "shared" ]; then
ENABLE_STATIC=--disable-static
Expand Down
5 changes: 3 additions & 2 deletions qtox/build_sodium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "sodium" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "sodium" --supported "linux-aarch64 linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$LIB_TYPE" = "shared" ]; then
ENABLE_STATIC=--disable-static
Expand All @@ -28,10 +28,11 @@ for sym in blake2b blake2b_final blake2b_init blake2b_init_key blake2b_init_para
RENAME_CFLAGS="$RENAME_CFLAGS -D$sym=sodium_$sym"
done

CFLAGS="-O3 $CROSS_CFLAG $RENAME_CFLAGS" \
CFLAGS="-O3 -fPIC $CROSS_CFLAG $RENAME_CFLAGS" \
LDFLAGS="$CROSS_LDFLAG -fstack-protector" \
./configure "$HOST_OPTION" \
--prefix="$DEP_PREFIX" \
--disable-pie \
"$ENABLE_STATIC" \
"$ENABLE_SHARED"

Expand Down
6 changes: 5 additions & 1 deletion qtox/build_vpx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "vpx" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "vpx" --supported "linux-aarch64 linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$SCRIPT_ARCH" == "win64" ]; then
# There is a bug in gcc that breaks avx512 on 64-bit Windows https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
Expand All @@ -36,6 +36,10 @@ elif [ "$SCRIPT_ARCH" == "linux-x86_64" ]; then
ARCH_FLAGS=""
CROSS_ARG=""
TARGET_ARG="x86_64-linux-gcc"
elif [ "$SCRIPT_ARCH" == "linux-aarch64" ]; then
ARCH_FLAGS=""
CROSS_ARG=""
TARGET_ARG="arm64-linux-gcc"
else
echo "Unsupported arch: $SCRIPT_ARCH"
exit 1
Expand Down

0 comments on commit 84aa6d0

Please sign in to comment.