Skip to content

Commit

Permalink
Packaging: write our own meson crossfile for appleOS
Browse files Browse the repository at this point in the history
We need to set CFLAGS that are not transfered through the regular prozess.
  • Loading branch information
fkuehne committed Mar 20, 2024
1 parent d18141d commit 47cdb05
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions extras/package/apple/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,46 @@ write_config_mak()
vlcSetSymbolEnvironment ac_var_to_export_ac_var >&3
}

# Write crossfile.meson for contribs
# Globals:
# VLC_HOST_CC
# VLC_HOST_CXX
# VLC_HOST_AR
# VLC_HOST_STRIP
# VLC_APPLE_SDK_PATH
# VLC_HOST_ARCH
write_crossfile_meson()
{
local meson_host_arch=$VLC_HOST_ARCH
if [ $meson_host_arch = "arm64" ]; then
meson_host_arch="aarch64"
fi
echo "Creating crossfile.meson..."
test -e crossfile.meson && unlink crossfile.meson
exec 3>crossfile.meson || return $?

printf "# This file was automatically generated by the appleOS build script!\n\n" >&3
printf "[binaries]\n" >&3
printf "c = ['%s', '-arch', '%s', '-isysroot', '%s']\n" "${VLC_HOST_CC}" "$VLC_HOST_ARCH" "$VLC_APPLE_SDK_PATH" >&3
printf "cpp = ['%s', '-arch', '%s', '-isysroot', '%s']\n" "${VLC_HOST_CC}" "$VLC_HOST_ARCH" "$VLC_APPLE_SDK_PATH" >&3
printf "objc = ['%s', '-arch', '%s', '-isysroot', '%s']\n" "${VLC_HOST_CC}" "$VLC_HOST_ARCH" "$VLC_APPLE_SDK_PATH" >&3
printf "objcpp = ['%s', '-arch', '%s', '-isysroot', '%s']\n" "${VLC_HOST_CC}" "$VLC_HOST_ARCH" "$VLC_APPLE_SDK_PATH" >&3
printf "ar = ['%s']\n" "${VLC_HOST_AR}" >&3
printf "strip = ['%s']\n" "${VLC_HOST_STRIP}" >&3
printf "pkgconfig = 'pkg-config'\n" >&3
printf "windres = 'windres'\n" >&3
printf "\n[properties]\n" >&3
printf "needs_exe_wrapper = true\n" >&3
printf "\n[host_machine]\n" >&3
printf "system = 'darwin'\n" >&3
printf "cpu_family = '%s'\n" "${meson_host_arch}" >&3
printf "endian = 'little'\n" >&3
printf "cpu = '%s'\n" "${meson_host_arch}" >&3
printf "\n[cmake]\n" >&3
printf "CMAKE_C_COMPILER = '%s'\n" "${VLC_HOST_CC}" >&3
printf "CMAKE_CXX_COMPILER = '%s'\n" "${VLC_HOST_CXX}" >&3
}

# Generate the source file with the needed array for
# the static VLC module list. This has to be compiled
# and linked into the static library
Expand Down Expand Up @@ -620,6 +660,9 @@ mkdir -p "$VLC_CONTRIB_INSTALL_DIR"
# Set flag to error on partial availability
write_config_mak "-Werror=partial-availability"

# Write crossfile-meson with flags for the build and compiler overrides
write_crossfile_meson

if [ "$VLC_USE_BITCODE" -gt "0" ]; then
VLC_CONTRIB_OPTIONS+=( "--enable-bitcode" )
fi
Expand Down

0 comments on commit 47cdb05

Please sign in to comment.