[vlc-commits] [Git][videolan/vlc][master] 10 commits: configure.ac: remove color parsing on NO_COLOR=1

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 30 13:51:31 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f3a959e7 by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
configure.ac: remove color parsing on NO_COLOR=1

When run from an environment not supporting colors, we should remove
them instead of printing the color descriptor anyway.

- - - - -
a18ceda2 by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
extras: apple: add extra version for simulators

The simulators are constrained to specific iOS and tvOS minimal version
and not respecting the constraint would lead to incorrect build and
linking failure.

Not sure how this should really be handled yet though, maybe the
build.sh script should get some parameter for that, or define the
targets depending on the SDK version.

- - - - -
3833584f by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
modules: Makefile.am: generate list of plugins

The build system is generating plugins and installing them at the PREFIX
location, but it is also often used by extra build scripts using it.
Those build scripts were trying to list the plugins by listing the files
in the PREFIX folder, but it was often inadequately using stall
plugins.

By generating an up-to-date list of plugins by the build system, we can
check when the plugin list have changed and which plugins should be
copied to the final application.

- - - - -
12c21c28 by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
apple: build.sh: use absolute path

Using absolute path enables the script from being called from a
different folder than a subfolder of the source directory in the
future.

- - - - -
529a072a by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
apple: build.sh: move contrib builds to vlc/contribs/

The contribs were built from contrib/contrib-xxx but installed into
build/contrib/xxx-yy so removing the build folder led to the contrib
being unused since every .target files from contrib/contrib-xxx would
still exist.

- - - - -
5a1e92d6 by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
apple: build.sh: disable subdirectory restriction

When building from XCode, the build folder won't be located into a
sub-directory so remove the restriction.

- - - - -
6866438d by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
apple: build.sh: ensure flags definition are stored

Ensure the flag definitions are stored in the config.status file.

- - - - -
3f9b85e2 by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
extras: apple: add xcodegen spec project

Add an XCodeGen project spec to generate an XCode project which will be
using autoconf and automake to build, as well as exposing the generated
artifacts to other XCode projects.

This will be generating the build artifacts inside the product build
directory from XCode, so `Clean build folder` will work as expected in
the editor, and use dynamic plugins to copy them towards the final
application for now.

This project allows testing VLC directly through the iosvlc.m test
driver, without building VLCKit nor VLC for iOS or another test
application, by directly using XCode to run it on the targetted
platform.

Exposing such project also allows debug symbols and debugguer with
breakpoint support to work automatically, even when using the artifacts
in another project.

The xcode.sh script is added as a wrapper script to handle the
specificities of XCode when calling external buildsystem, in particular
the multi-arch building for archiving application and packages.

The copy_plugins.sh is added as a build phase script so that application
can install the plugins matching the architecture being built. It
currently probably fails with cases where some plugins are not built for
every architecture of a platform since I haven't tested that yet. It is
also quite "dumb" and re-do everything from scratch for now.

- - - - -
5a889373 by Maxime Chapelet at 2024-05-30T12:34:36+00:00
xcodegen: generate dSYM bundles from binary copy script

We have to generate dSYM bundle from the script because Xcode might
already have generated them before binary lipo/copy execution.

- - - - -
332b22cf by Alexandre Janniaux at 2024-05-30T12:34:36+00:00
apple: generate.sh: add a script to generate xcodeproj

The script explains how to generate the xcode project and will generate
a folder containing the project at the current working directory where
it has been used.

- - - - -


8 changed files:

- configure.ac
- extras/package/apple/build.conf
- extras/package/apple/build.sh
- + extras/package/apple/copy_plugins.sh
- + extras/package/apple/generate.sh
- + extras/package/apple/xcode.sh
- + extras/package/apple/xcodegen.yml
- modules/Makefile.am


Changes:

=====================================
configure.ac
=====================================
@@ -4896,7 +4896,11 @@ echo "#! $SHELL
 rm -f .error\$\$
 ERROR=0
 export PATH=\"$PATH\" LANG=C
+if [ "$NO_COLOR" = 1 ]; then
+($MAKE V=1 \$@ 2>&1 || touch .error\$\$)
+else
 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| $compile_top_srcdir/extras/buildsystem/make.pl
+fi
 test -f .error\$\$ && ERROR=1
 rm -f .error\$\$
 exit \$ERROR" >compile


=====================================
extras/package/apple/build.conf
=====================================
@@ -14,8 +14,10 @@
 export VLC_DEPLOYMENT_TARGET_MACOSX="10.11"
 # iOS deployment target
 export VLC_DEPLOYMENT_TARGET_IOS="9.0"
+export VLC_DEPLOYMENT_TARGET_IOS_SIMULATOR="12.0"
 # tvOS deployment target
 export VLC_DEPLOYMENT_TARGET_TVOS="11.0"
+export VLC_DEPLOYMENT_TARGET_TVOS_SIMULATOR="12.0"
 # xrOS deployment target
 export VLC_DEPLOYMENT_TARGET_XROS="1.0"
 


=====================================
extras/package/apple/build.sh
=====================================
@@ -28,12 +28,6 @@
 # Dir of this script
 readonly VLC_SCRIPT_DIR="$(cd "${BASH_SOURCE%/*}"; pwd)"
 
-# Verify script run location
-[ ! -f "$(pwd)/../src/libvlc.h" ] \
-    && echo "ERROR: This script must be run from a" \
-            "build subdirectory in the VLC source" >&2 \
-    && exit 1
-
 # Include vlc env script
 . "$VLC_SCRIPT_DIR/../macosx/env.build.sh" "none"
 
@@ -295,7 +289,7 @@ validate_sdk_name()
             VLC_HOST_PLATFORM="iOS-Simulator"
             VLC_HOST_PLATFORM_SIMULATOR="yes"
             VLC_HOST_OS="ios"
-            set_deployment_target "$VLC_DEPLOYMENT_TARGET_IOS"
+            set_deployment_target "$VLC_DEPLOYMENT_TARGET_IOS_SIMULATOR"
             ;;
         appletvos*)
             VLC_HOST_PLATFORM="tvOS"
@@ -306,7 +300,7 @@ validate_sdk_name()
             VLC_HOST_PLATFORM="tvOS-Simulator"
             VLC_HOST_PLATFORM_SIMULATOR="yes"
             VLC_HOST_OS="tvos"
-            set_deployment_target "$VLC_DEPLOYMENT_TARGET_TVOS"
+            set_deployment_target "$VLC_DEPLOYMENT_TARGET_TVOS_SIMULATOR"
             ;;
         macosx*)
             VLC_HOST_PLATFORM="macOS"
@@ -585,7 +579,7 @@ set_build_triplet
 # FIXME: This should match the actual clang triplet and should be used for compiler invocation too!
 readonly VLC_PSEUDO_TRIPLET="${VLC_HOST_ARCH}-apple-${VLC_HOST_PLATFORM}_${VLC_DEPLOYMENT_TARGET}"
 # Contrib install dir
-readonly VLC_CONTRIB_INSTALL_DIR="$VLC_BUILD_DIR/contrib/${VLC_HOST_ARCH}-${VLC_APPLE_SDK_NAME}"
+readonly VLC_CONTRIB_INSTALL_DIR="$VLC_SRC_DIR/contrib/${VLC_HOST_ARCH}-${VLC_APPLE_SDK_NAME}"
 # VLC install dir
 readonly VLC_INSTALL_DIR="$VLC_BUILD_DIR/vlc-${VLC_APPLE_SDK_NAME}-${VLC_HOST_ARCH}"
 
@@ -779,13 +773,17 @@ cd "${VLC_BUILD_DIR}/build" || abort_err "Failed cd to VLC build dir"
 # Create VLC install dir if it does not already exist
 mkdir -p "$VLC_INSTALL_DIR"
 
+
 vlcSetSymbolEnvironment \
-hostenv ../../configure \
-    --with-contrib="$VLC_CONTRIB_INSTALL_DIR" \
+hostenv "${VLC_SRC_DIR}/configure" \
     --host="$VLC_HOST_TRIPLET" \
     --build="$VLC_BUILD_TRIPLET" \
     --prefix="$VLC_INSTALL_DIR" \
+    --with-contrib="$VLC_CONTRIB_INSTALL_DIR" \
     "${VLC_CONFIG_OPTIONS[@]}" \
+    CFLAGS="${CFLAGS}" \
+    OBJCFLAGS="${OBJCFLAGS}" \
+    CXXFLAGS="${CXXFLAGS}" \
  || abort_err "Configuring VLC failed"
 
 $MAKE || abort_err "Building VLC failed"


=====================================
extras/package/apple/copy_plugins.sh
=====================================
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+function plist_key()
+{
+    KEY="$1"
+    VALUE="$2"
+    echo '  <key>'"${KEY}"'</key>'
+    echo '  <string>'"${VALUE}"'</string>'
+}
+
+function generate_info_plist()
+{
+    EXECUTABLE_NAME="$1"
+    echo '<?xml version="1.0" encoding="UTF-8"?>'
+    echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'
+    echo '<plist version="1.0">'
+    echo '<dict>'
+    plist_key CFBundleDevelopmentRegion "en"
+    plist_key CFBundleExecutable "${EXECUTABLE_NAME}"
+    plist_key CFBundleIdentifier "org.videolan.vlc.plugins.${EXECUTABLE_NAME}.framework"
+    plist_key CFBundleInfoDictionaryVersion "6.0"
+    plist_key CFBundlePackageType "FMWK"
+    plist_key CFBundleSignature "???"
+    echo '</dict>'
+    echo '</plist>'
+}
+
+PLUGINS=()
+for arch in ${ARCHS}; do
+  while read -r plugin; do
+    if [[ ! "${PLUGINS[@]}" =~ "${plugin}" ]]; then
+      PLUGINS+=( "${plugin}" )
+    fi
+  done < "${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}/build/modules/vlc_modules_list"
+done
+
+for plugin in "${PLUGINS[@]}"; do
+    echo "Copying plugin $plugin for platform ${PLATFORM_NAME}"
+
+    INPUT_FILES=()
+    for arch in ${ARCHS}; do
+        input_file="${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}/build/modules/.libs/lib${plugin}.dylib"
+        if [ ! -f "${input_file}" ]; then
+            continue
+        fi
+        echo " - Adding plugin file ${input_file} for lipo"
+        INPUT_FILES+=( "$input_file" )
+    done
+    FRAMEWORK_DIR="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/${plugin}.framework"
+    FRAMEWORK_BIN_PATH="${FRAMEWORK_DIR}/${plugin}"
+    mkdir -p "${FRAMEWORK_DIR}"
+    lipo -create \
+        -output "${FRAMEWORK_BIN_PATH}" \
+        "${INPUT_FILES[@]}"
+    install_name_tool -change "@rpath/libvlccore.dylib" "@rpath/vlccore.framework/vlccore" \
+        "${FRAMEWORK_BIN_PATH}"
+    dsymutil -o "${FRAMEWORK_DIR}.dSYM" "${FRAMEWORK_BIN_PATH}"
+    generate_info_plist "${plugin}" > "${FRAMEWORK_DIR}/Info.plist"
+    codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" "${FRAMEWORK_DIR}"
+done


=====================================
extras/package/apple/generate.sh
=====================================
@@ -0,0 +1,10 @@
+#!/usr/bin/env sh
+
+SCRIPTDIR="$(cd "$(dirname "$0")" || exit 1; pwd)"
+VLC_SRC_DIR="$(cd "${SCRIPTDIR}/../../../" || exit 1; pwd)"
+PROJECTDIR="$(pwd)/xcodeproj/"
+
+export VLC_SRC_DIR
+mkdir -p "${PROJECTDIR}" && cd "${PROJECTDIR}" || exit 1
+
+xcodegen generate --project . --spec "${VLC_SRC_DIR}/extras/package/apple/xcodegen.yml" --project-root .


=====================================
extras/package/apple/xcode.sh
=====================================
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+SCRIPTDIR="$(cd "$(dirname "$0")" || exit 1; pwd)"
+SRCROOT="${SCRIPTDIR}/../../../"
+
+# https://developer.apple.com/documentation/xcode-release-notes/build-system-release-notes-for-xcode-10
+# > The new build system passes undefined_arch as the value for the ARCH
+# > environment variable when running shell script build phases. The value was
+# > previously not well defined. Any shell scripts depending on this value must
+# > behave correctly for all defined architectures being built, available via
+# > the ARCHS environment variable.
+
+MAKEFLAGS="-j6"
+
+for arch in $ARCHS; do
+    echo "Building platform ${PLATFORM_NAME} for arch ${arch}"
+    BUILD_DIR="${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}/"
+    if [ ! -f "${BUILD_DIR}/build/config.h" ] || [ ! -d "${SRCROOT}/contrib/${arch}-${PLATFORM_NAME}" ]; then
+        mkdir -p "${BUILD_DIR}"
+        (cd "${BUILD_DIR}" && env -i NO_COLOR=1 V=1 VERBOSE=1 MAKEFLAGS="$MAKEFLAGS" "${SCRIPTDIR}/build.sh" \
+            --enable-shared --arch="${arch}" --sdk="${PLATFORM_NAME}")
+    else
+        (cd "${BUILD_DIR}/build/" && env -i NO_COLOR=1 ./compile MAKEFLAGS="$MAKEFLAGS" V=1 VERBOSE=1)
+    fi
+done


=====================================
extras/package/apple/xcodegen.yml
=====================================
@@ -0,0 +1,119 @@
+name: VLC
+options:
+  bundleIdPrefix: org.videolan.vlc
+  supportedDestinations: [iOS, tvOS, visionOS]
+  deploymentTarget:
+    iOS: 9.0
+    tvOS: 12.0
+configs:
+  Debug: debug
+  Release: release
+settings:
+  configs:
+fileGroups:
+  - "${VLC_SRC_DIR}/bin"
+  - "${VLC_SRC_DIR}/src"
+  - "${VLC_SRC_DIR}/include"
+  - "${VLC_SRC_DIR}/modules"
+  - "${VLC_SRC_DIR}/lib"
+  - "${VLC_SRC_DIR}/test"
+  - "${VLC_SRC_DIR}/contrib/src"
+  - "${VLC_SRC_DIR}/contrib/bootstrap"
+  - "${VLC_SRC_DIR}/doc"
+  - "${VLC_SRC_DIR}/extras/package/apple/"
+targets:
+  VLCAutomake:
+    type: ""
+    supportedDestinations: [iOS, tvOS, visionOS]
+    legacy:
+      toolPath: ${VLC_SRC_DIR}/extras/package/apple/xcode.sh
+      passSettings: true
+      workingDirectory: ${VLC_SRC_DIR}
+
+  vlccoreios:
+    type: "application"
+    supportedDestinations: [iOS, tvOS, visionOS]
+    dependencies:
+      - target: VLCAutomake
+      - target: vlc
+      - target: vlccore
+    info:
+      path: "vlccoreios/Info.plist"
+    settings:
+      PRODUCT_BUNDLE_IDENTIFIER: org.videolan.vlc.vlccoreios
+    postBuildScripts:
+      - script: ${VLC_SRC_DIR}/extras/package/apple/copy_plugins.sh
+        name: "Copy VLC plugins"
+
+      - name: Copy vlccoreios binary
+        shell: /bin/bash
+        script: |
+            INPUT_FILES=()
+            for arch in ${ARCHS}; do
+                INPUT_FILES+=("${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}${BUILD_SUFFIX}/build/test/.libs/vlccoreios")
+            done
+            lipo -create \
+                -output "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" \
+                "${INPUT_FILES[@]}"
+            install_name_tool -change "@rpath/libvlc.dylib" "@rpath/vlc.framework/vlc" \
+                "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+            install_name_tool -change "@rpath/libvlccore.dylib" "@rpath/vlccore.framework/vlccore" \
+                "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+            codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+  vlc:
+    type: "framework"
+    supportedDestinations: [iOS, tvOS, visionOS]
+    dependencies:
+      - target: VLCAutomake
+    info:
+      path: "vlc/Info.plist"
+
+    postBuildScripts:
+      - name: Copy libvlc library
+        shell: /bin/bash
+        script: |
+            INPUT_FILES=()
+            for arch in ${ARCHS}; do
+                input_file="${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}${BUILD_SUFFIX}/build/lib/.libs/libvlc.dylib"
+                echo " + Adding input $input_file"
+                INPUT_FILES+=( "$input_file" )
+            done
+            FRAMEWORK_DIR="${BUILT_PRODUCTS_DIR}/vlc.framework"
+            FRAMEWORK_BIN_PATH="${FRAMEWORK_DIR}/vlc"
+            lipo -create \
+                -output "${FRAMEWORK_BIN_PATH}" \
+                "${INPUT_FILES[@]}"
+            dsymutil -o "${FRAMEWORK_DIR}.dSYM" "${FRAMEWORK_BIN_PATH}"
+
+  vlccore:
+    type: "framework"
+    supportedDestinations: [iOS, tvOS, visionOS]
+    dependencies:
+      - target: VLCAutomake
+    info:
+      path: "vlccore/Info.plist"
+    sources:
+      - path: ${VLC_SRC_DIR}/include/
+        includes: "vlc_*.h"
+        buildPhase: headers
+        headerVisibility: public
+    postBuildScripts:
+      - name: Copy vlccore library
+        shell: /bin/bash
+        buildRules:
+        script: |
+            INPUT_FILES=()
+            for arch in ${ARCHS}; do
+                input_file="${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}/build/src/.libs/libvlccore.dylib"
+                echo " + Adding input $input_file"
+                INPUT_FILES+=( "$input_file" )
+            done
+            FRAMEWORK_DIR="${BUILT_PRODUCTS_DIR}/vlccore.framework"
+            FRAMEWORK_BIN_PATH="${FRAMEWORK_DIR}/vlccore"
+            lipo -create \
+                -output "${FRAMEWORK_BIN_PATH}" \
+                "${INPUT_FILES[@]}"
+            # We have to generate dSYM bundle here because Xcode might
+            # already have generated them before script execution
+            dsymutil -o "${FRAMEWORK_DIR}.dSYM" "${FRAMEWORK_BIN_PATH}"
+


=====================================
modules/Makefile.am
=====================================
@@ -82,3 +82,22 @@ SUFFIXES += -client-protocol.h -protocol.c .xml
 .xml-protocol.c:
 	$(AM_V_GEN)$(WAYLAND_SCANNER) private-code < "$^" > "$@.tmp"
 	$(AM_V_at)mv -f -- "$@.tmp" "$@"
+
+# Remove the non-plugins, it needs intermediate steps because
+# we can only replace and not match inverse. Instead we;
+#  1/ replace plugins .la targets by plugins names
+#  2/ remove every word which is a .la target (ie. non-plugins)
+#  3/ rename every plugin name back into the target name
+ALL_TARGETS_PLUGIN_RENAMED := $(LTLIBRARIES:lib%_plugin.la=%_plugin)
+PLUGINS_NAMES := $(ALL_TARGETS_PLUGIN_RENAMED:%.la=)
+
+# Generate a list containing the name of every plugin being built
+# Note that it cannot include plugins from recursive makefiles,
+# like the Qt plugin.
+vlc_modules_list: Makefile
+	$(AM_V_GEN)rm -f $@.tmp; for plugin in $(PLUGINS_NAMES); do \
+		printf "$${plugin}\n" >> $@.tmp; done && \
+		mv $@.tmp $@
+
+BUILT_SOURCES += vlc_modules_list
+CLEANFILES += vlc_modules_list



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3bb7c0e5aa71a9d022668ef049543a495fcb5061...332b22cf8015f1b8b28cf4ec411f23199ce92ac4

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3bb7c0e5aa71a9d022668ef049543a495fcb5061...332b22cf8015f1b8b28cf4ec411f23199ce92ac4
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list