Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
9b92c0b3 by Alexandre Janniaux at 2026-01-21T16:06:07+01:00
extras: apple: move VLC_DEPLOYMENT_TARGET up in config.mak

The variables for compiler flags are using direct assignment (ie. :=)
and the variables are interpolated directly. By moving the
VLC_DEPLOYMENT_TARGET up, we can use this variable in the compiler flags
instead of hardcoding it.

Note that the target cflag and target ldflag are still using hardcoded
values, because they are also used in VLC's configure.

- - - - -
4c6fbdee by Alexandre Janniaux at 2026-01-21T16:06:07+01:00
extras: apple: use make variables for config.mak

Instead of expanding VLC_DEPLOYMENT_TARGET_CFLAG and
VLC_DEPLOYMENT_TARGET_LDFLAG to literal strings at generation time,
write them as make variable references in config.mak. This allows the
flags to be resolved at make time, allowing to modify them easily.

- - - - -
05d60dfe by Alexandre Janniaux at 2026-01-21T16:06:07+01:00
extras: apple: add --config script argument

Allow users to specify a custom build configuration file using the
--config=FILE command-line argument. This enables build customization
without modifying the default build.conf, in particular to target
higher version of the platform or enable more modules.

Usage:
  ../extras/package/apple/build.sh \
      --sdk=iphoneos --arch=arm64 \
      --config=/path/to/custom.conf

- - - - -


1 changed file:

- extras/package/apple/build.sh


Changes:

=====================================
extras/package/apple/build.sh
=====================================
@@ -31,9 +31,6 @@ readonly VLC_SCRIPT_DIR="$(cd "${BASH_SOURCE%/*}"; pwd)"
 # Include vlc env script
 . "$VLC_SCRIPT_DIR/../macosx/env.build.sh" "none"
 
-# Include build config file
-. "$VLC_SCRIPT_DIR/build.conf"
-
 ##########################################################
 #                    Global variables                    #
 ##########################################################
@@ -46,6 +43,8 @@ readonly VLC_SRC_DIR=$(vlcGetRootDir)
 readonly VLC_BUILD_DIR=$(pwd)
 # Whether verbose output is enabled or not
 VLC_SCRIPT_VERBOSE=0
+# Path to build configuration file
+: "${VLC_BUILD_CONF_PATH:="$VLC_SCRIPT_DIR/build.conf"}"
 # Architecture of the host (OS that the result will run on)
 VLC_HOST_ARCH="x86_64"
 # Host platform information
@@ -120,6 +119,8 @@ usage()
     echo " --arch=ARCH      Architecture to build for"
     echo "                   (i386|x86_64|armv7|arm64)"
     echo " --sdk=SDK        Name of the SDK to build with (see 'xcodebuild 
-showsdks')"
+    echo " --config=FILE    Path to build configuration file"
+    echo "                   (default: ./build.conf)"
     echo " --enable-bitcode        Enable bitcode for compilation, same as 
with =full"
     echo " --enable-bitcode=marker Enable bitcode marker for compilation"
     echo " --disable-debug  Disable libvlc debug mode (for release)"
@@ -168,6 +169,26 @@ check_tool()
     }
 }
 
+# Validate and set the build config file path
+# Globals:
+#   VLC_BUILD_CONF_PATH
+# Arguments:
+#   Optional config file path
+validate_build_conf()
+{
+    local conf_path="$1"
+
+    # Expand relative paths to absolute paths
+    conf_path="$(cd "$(dirname "$conf_path")" 2>/dev/null && pwd)/$(basename 
"$conf_path")"
+
+    if [ ! -f "$conf_path" ] || [ ! -r "$conf_path" ]; then
+        abort_err "Build config file not found or not readable: $conf_path"
+    fi
+
+    VLC_BUILD_CONF_PATH="$conf_path"
+    verbose_msg "Using build config: $conf_path"
+}
+
 # Set the VLC_DEPLOYMENT_TARGET* flag options correctly
 # Globals:
 #   VLC_DEPLOYMENT_TARGET
@@ -386,7 +407,7 @@ ac_var_to_export_ac_var()
 write_config_mak()
 {
     # Flags to be used for C-like compilers (C, C++, Obj-C)
-    local clike_flags="$VLC_DEPLOYMENT_TARGET_CFLAG -arch $VLC_HOST_ARCH 
-isysroot $VLC_APPLE_SDK_PATH $1"
+    local clike_flags="\$(VLC_DEPLOYMENT_TARGET_CFLAG) -arch $VLC_HOST_ARCH 
-isysroot $VLC_APPLE_SDK_PATH $1"
 
     local vlc_cppflags="-arch $VLC_HOST_ARCH -isysroot $VLC_APPLE_SDK_PATH"
     local vlc_cflags="$clike_flags"
@@ -394,13 +415,17 @@ write_config_mak()
     local vlc_objcflags="$clike_flags"
 
     # Vanilla clang doesn't use VLC_DEPLOYMENT_TAGET_LDFLAGS but only the 
CFLAGS variant
-    local vlc_ldflags="$VLC_DEPLOYMENT_TARGET_LDFLAG 
$VLC_DEPLOYMENT_TARGET_CFLAG  -arch $VLC_HOST_ARCH"
+    local vlc_ldflags="\$(VLC_DEPLOYMENT_TARGET_LDFLAG) 
\$(VLC_DEPLOYMENT_TARGET_CFLAG) -arch $VLC_HOST_ARCH"
 
     echo "Creating makefile..."
     test -e config.mak && unlink config.mak
     exec 3>config.mak || return $?
 
     printf '# This file was automatically generated!\n\n' >&3
+    printf '%s := %s\n' "VLC_DEPLOYMENT_TARGET" "${VLC_DEPLOYMENT_TARGET}" >&3
+    printf '%s := %s\n' "VLC_DEPLOYMENT_TARGET_CFLAG" 
"${VLC_DEPLOYMENT_TARGET_CFLAG}" >&3
+    printf '%s := %s\n' "VLC_DEPLOYMENT_TARGET_LDFLAG" 
"${VLC_DEPLOYMENT_TARGET_LDFLAG}" >&3
+
     printf '%s := %s\n' "CPPFLAGS" "${vlc_cppflags}" >&3
     printf '%s := %s\n' "CFLAGS" "${vlc_cflags}" >&3
     printf '%s := %s\n' "CXXFLAGS" "${vlc_cxxflags}" >&3
@@ -416,10 +441,6 @@ write_config_mak()
     printf '%s := %s\n' "RANLIB" "${VLC_HOST_RANLIB}" >&3
     printf '%s := %s\n' "NM" "${VLC_HOST_NM}" >&3
 
-    printf '%s := %s\n' "VLC_DEPLOYMENT_TARGET" "${VLC_DEPLOYMENT_TARGET}" >&3
-    printf '%s := %s\n' "VLC_DEPLOYMENT_TARGET_CFLAG" 
"${VLC_DEPLOYMENT_TARGET_CFLAG}" >&3
-    printf '%s := %s\n' "VLC_DEPLOYMENT_TARGET_LDFLAG" 
"${VLC_DEPLOYMENT_TARGET_LDFLAG}" >&3
-
     # Add the ac_cv_ var exports in the config.mak for the contribs
     echo "Appending ac_cv_ vars to config.mak"
     vlcSetSymbolEnvironment ac_var_to_export_ac_var >&3
@@ -502,6 +523,9 @@ do
         --enable-extra-checks)
             VLC_BUILD_EXTRA_CHECKS=1
             ;;
+        --config=*)
+            VLC_BUILD_CONF_PATH="${1#--config=}"
+            ;;
         VLC_PREBUILT_CONTRIBS_URL=*)
             VLC_PREBUILT_CONTRIBS_URL="${1#VLC_PREBUILT_CONTRIBS_URL=}"
             ;;
@@ -517,6 +541,9 @@ do
     shift
 done
 
+validate_build_conf "${VLC_BUILD_CONF_PATH}"
+. "${VLC_BUILD_CONF_PATH}" || abort_err "Failed to source build config: 
${VLC_BUILD_CONF_PATH}"
+
 export MAKEFLAGS="-j${VLC_USE_NUMBER_OF_CORES} ${MAKEFLAGS}"
 if [ "${VLC_REQUESTED_CORE_COUNT}" != "0" ]; then
     export MAKEFLAGS="${MAKEFLAGS} -j${VLC_REQUESTED_CORE_COUNT}"



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0ab833bfbb2012fabfa9f2e308261b8abaed3647...05d60dfed9df09cd4931d117cae535809243c6ce

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0ab833bfbb2012fabfa9f2e308261b8abaed3647...05d60dfed9df09cd4931d117cae535809243c6ce
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to