Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f02e9412 by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
contrib: gen-meson-machinefile: provide executables from contrib

- - - - -
58adf838 by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
contrib: meson-machinefile: fix dependencies

Ensure that the meson-machinefile built depends on whether the script
has changed and on the latest state of the contribs. This will also be
used to depends on which binaries are built for the contribs.

- - - - -
a91ff16c by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
contrib: protobuf: expose tool path

- - - - -
a6317d65 by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
contrib: protobuf: update URL

google/protobuf redirects to protocolbuffers/protobuf now.

- - - - -
d9793296 by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
contrib: lua: expose tool path

- - - - -
e53da4bf by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
contrib: meson-machinefile provide the binary from makefile

Provide the necessary binary overrides throught the machine files
exposing the contribs, and ensure that the meson-machinefile built
depends on which binaries are built.

The new build tool generation uses a new PKGS.tools variable which
should match with the names used to find the different programs.

Not all programs can be found this way. For instance, it seems that the
Qt module from meson will completely ignore this parameter and load for
the Qt installation anyway.

- - - - -
b77311d3 by Alexandre Janniaux at 2024-04-17T09:12:07+00:00
chromecast: meson.build: check both x.y and x.y.z for protoc

Protobuf and protoc version naming changed starting after version
21.7.11.x, at version 22.x.y[^2]. Other versioning changes during the
21.* cycle were made right before[^1].

The new versioning is described on the specific page from protocol
buffers website[^3].

For instance, protoc from archlinux currently outputs version 25.3,
leading to the following message if checking a 3-number version number
like the version in the contribs:

    Program protoc found: NO found 25.3 but need: '25.3.0' 
(/usr/bin/protoc)

After this patch we have the following with version 25.3:

    Program protoc found: YES 25.3 25.3 (/usr/bin/protoc)

and with version 21.1 from contrib:

    Program protoc found: YES 3.21.1 3.21.1

[^1]: https://protobuf.dev/news/2022-05-06/
[^2]: https://protobuf.dev/news/2022-07-06/
[^3]: https://protobuf.dev/support/version-support/

- - - - -


5 changed files:

- contrib/src/gen-meson-machinefile.py
- contrib/src/lua/rules.mak
- contrib/src/meson-machinefile/rules.mak
- contrib/src/protobuf/rules.mak
- modules/stream_out/chromecast/meson.build


Changes:

=====================================
contrib/src/gen-meson-machinefile.py
=====================================
@@ -3,6 +3,19 @@ import os
 import argparse
 import shlex
 
+class BinaryAction(argparse.Action):
+    def __init__(self, option_strings, dest, nargs=None, **kwargs):
+        super().__init__(option_strings, dest, **kwargs)
+
+    def __call__(self, parser, namespace, value, option_string=None):
+        split = value.split(':')
+        if (len(split) < 2 or split[0] == '' or split[1] == ''):
+            raise ValueError("Syntax: --binary foo:/usr/bin/foo")
+        name = split[0]
+        if (getattr(namespace, 'binary') is None):
+            setattr(namespace, 'binary', {})
+        namespace.binary[name] = ':'.join(split[1:])
+
 # Argument parsing
 parser = argparse.ArgumentParser(
     description="Generate a meson crossfile based on environment variables")
@@ -16,6 +29,7 @@ external-*: External machine file (either cross or native).
             This is meant to be used by VLCs meson build system to easily
             use the given contribs, similar to --with-contrib=DIR for 
./configure
 """)
+parser.add_argument('--binary', action=BinaryAction, nargs='*')
 parser.add_argument('file', type=argparse.FileType('w', encoding='UTF-8'),
     help="output file")
 args = parser.parse_args()
@@ -84,6 +98,10 @@ if args.type == 'internal':
 
 elif args.type.startswith('external'):
     # Constants section
+    if args.binary is not None:
+        args.file.write("\n[binaries]\n")
+        for program_name, program_path in args.binary.items():
+            args.file.write(f"{program_name} = '{program_path}'\n")
     args.file.write("\n[constants]\n")
     args.file.write("contrib_dir = '{}'\n".format(os.environ['PREFIX']))
     args.file.write("contrib_libdir = contrib_dir / 'lib'\n")


=====================================
contrib/src/lua/rules.mak
=====================================
@@ -29,6 +29,8 @@ endif
 PKGS += lua luac
 PKGS_TOOLS += luac
 PKGS_ALL += luac
+PKGS.tools += luac
+PKGS.tools.luac.path = $(BUILDBINDIR)/$(HOST)-luac
 
 LUAC_IF_NOT_CROSS =
 ifndef HAVE_CROSS_COMPILE


=====================================
contrib/src/meson-machinefile/rules.mak
=====================================
@@ -13,19 +13,23 @@ else
 CROSS_OR_NATIVE := native
 endif
 
-meson-machinefile/contrib.ini: $(SRC)/gen-meson-machinefile.py
-       mkdir -p meson-machinefile
-       PREFIX="$(PREFIX)" \
-       $(SRC)/gen-meson-machinefile.py --type external-$(CROSS_OR_NATIVE) $@
+meson-machinefile:
+       mkdir -p $@
 
-meson-machinefile: meson-machinefile/contrib.ini
+meson-machinefile/contrib.ini: $(foreach tool,$(filter-out 
$(PKGS_FOUND),$(PKGS.tools)),.dep-$(tool))
+meson-machinefile/contrib.ini: $(SRC)/gen-meson-machinefile.py 
meson-machinefile
+       PREFIX="$(PREFIX)" \
+       $(SRC)/gen-meson-machinefile.py \
+               --type external-$(CROSS_OR_NATIVE) \
+               $(foreach tool,$(filter-out 
$(PKGS_FOUND),$(PKGS.tools)),--binary $(tool):$(PKGS.tools.$(tool).path)) \
+               $@
 
 # Dummy target, there is nothing to check
 # as we download nothing.
 .sum-meson-machinefile:
        touch $@
 
-.meson-machinefile: meson-machinefile
+.meson-machinefile: meson-machinefile/contrib.ini
        install -d "$(PREFIX)/share/meson/$(CROSS_OR_NATIVE)"
-       install $</contrib.ini "$(PREFIX)/share/meson/$(CROSS_OR_NATIVE)"
+       install meson-machinefile/contrib.ini 
"$(PREFIX)/share/meson/$(CROSS_OR_NATIVE)"
        touch $@


=====================================
contrib/src/protobuf/rules.mak
=====================================
@@ -4,11 +4,12 @@ PROTOBUF_MAJVERSION := 21
 PROTOBUF_REVISION := 1
 PROTOBUF_VERSION := $(PROTOBUF_MAJVERSION).$(PROTOBUF_REVISION)
 PROTOBUF_PACKAGE := 
$(PROTOBUF_MAJPACKAGE).$(PROTOBUF_MAJVERSION).$(PROTOBUF_REVISION)
-PROTOBUF_URL := 
$(GITHUB)/google/protobuf/releases/download/v$(PROTOBUF_VERSION)/protobuf-cpp-$(PROTOBUF_PACKAGE).tar.gz
+PROTOBUF_URL := 
$(GITHUB)/protocolbuffers/protobuf/releases/download/v$(PROTOBUF_VERSION)/protobuf-cpp-$(PROTOBUF_PACKAGE).tar.gz
 
 ifndef HAVE_TVOS
 PKGS += protobuf protoc
 PKGS_TOOLS += protoc
+PKGS.tools += protoc
 endif # !HAVE_TVOS
 PKGS_ALL += protoc
 ifeq ($(call need_pkg, "protobuf-lite = $(PROTOBUF_VERSION)"),)
@@ -17,6 +18,7 @@ ifndef HAVE_CROSS_COMPILE
 PKGS_FOUND += protoc
 endif
 endif
+PKGS.tools.protoc.path = $(BUILDBINDIR)/$(HOST)-protoc
 
 ifeq ($(shell $(HOST)-protoc --version 2>/dev/null | head -1 | sed s/'.* '// | 
cut -d '.' -f -2),$(PROTOBUF_MAJVERSION))
 PKGS_FOUND += protoc


=====================================
modules/stream_out/chromecast/meson.build
=====================================
@@ -4,10 +4,27 @@ protoc = disabler()
 chromecast_proto = []
 
 if protobuf_dep.found()
+    # Protoc can output either a 2-number version or a 3-number version...
+    # Protobuf switched from version naming 3.20.12.z to version 21.7.z, and
+    # protoc provide compatibility with version x.y now. But version 21.y.z
+    # still outputs the previous kind of version naming up until 3.21.12.z
+    # included, so the first version with the x.y format is 22.0.
     protobuf_version_list = protobuf_dep.version().split('.')
+    if protobuf_dep.version().version_compare('< 3.22.0.0')
+        protoc_version = '@0@.@1@.@2@'.format(
+            protobuf_version_list[0],
+            protobuf_version_list[1],
+            protobuf_version_list[2])
+    else
+        # Protobuf version is x.y.z and protoc version is x.y
+        protoc_version = '@0@.@1@'.format(protobuf_version_list[0], 
protobuf_version_list[1])
+    endif
     protoc = find_program('protoc',
-        version: '@0@.@1@'.format(protobuf_version_list[0], 
protobuf_version_list[1]),
+        version: protoc_version,
         required: get_option('chromecast'))
+endif
+
+if protoc.found()
     protobuf_gen = generator(protoc,
         output: [
             '@basen...@.pb.cc'.format(protobuf_dep.version()),



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/30b5a2ac41c777c65d5279cbf40adc6205b72e32...b77311d30707112b2f3aa98259e076c6423df8d5

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/30b5a2ac41c777c65d5279cbf40adc6205b72e32...b77311d30707112b2f3aa98259e076c6423df8d5
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to