Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
  • abdsaber000/vlc
  • falbrechtskirchinger/vlc
405 results
Show changes
Commits on Source (9)
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2022 Loïc Branstett <loic@videolabs.io>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# This is a wrapper/interceptor script for Cargo (the Rust package manager) that adds
# the ability to specify an output directory for the final compiler artifact
# (archive lib, depfile).
#
# Usage: ./buildsystem/cargo-output.py --output=out/ --depfile NORMAL_CARGO_INVOCATION
# Usage: ./buildsystem/cargo-output.py --output=out/ --depfile /usr/bin/cargo
# --target=x86_64-unknown-linux-gnu rustc --crate-type=staticlib
#
# The resulting static library will be put in the output directory as well as its depfile
# if asked (--depfile) and available
import os, sys, json, pathlib, shutil, subprocess, argparse
def dir_path(string):
if os.path.isdir(string):
return string
else:
raise NotADirectoryError(string)
parser = argparse.ArgumentParser()
parser.add_argument("--depfile", action="store_true")
parser.add_argument("-o", "--output", type=dir_path)
parser.add_argument("cargo_cmds", nargs=argparse.REMAINDER)
args = parser.parse_args()
cargo_argv = args.cargo_cmds
# Insert Cargo argument `--message-format=json-render-diagnostics`
# before a `--` (if there are any) to still be in Cargo arguments
# and not in the inner thing (rustc, ...)
cargo_argv.insert(
cargo_argv.index('--') if '--' in cargo_argv else len(cargo_argv),
"--message-format=json-render-diagnostics"
)
# Execute the cargo build and redirect stdout (and not stderr)
cargo_r = subprocess.run(cargo_argv, stdout=subprocess.PIPE)
# We don't use `check=True` in the above `run` method call because it
# raise an execption and outputing a python traceback isn't useful at all
if cargo_r.returncode != 0:
sys.exit(cargo_r.returncode)
# Get the jsons output
cargo_stdout = cargo_r.stdout.decode('utf-8')
cargo_jsons = [json.loads(line) for line in cargo_stdout.splitlines()]
# We are only interrested in the final artifact (ie the output, not it's deps)
last_compiler_artifact = next(
j for j in reversed(cargo_jsons) if j["reason"] == "compiler-artifact")
# We only take the first one, because the other one are just aliases and thus
# are not relevant for us
first_compiler_artifact_filename = last_compiler_artifact["filenames"][0]
for filename in [first_compiler_artifact_filename]:
shutil.copy2(filename, args.output)
if args.depfile:
shutil.copy2(pathlib.Path(filename).with_suffix(".d"), args.output)
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2022 Loïc Branstett <loic@videolabs.io>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# This script is meant to find the required native libs of an empty Rust crate
# compiled as a static lib.
#
# Usage: ./buildsystem/cargo-rustc-static-libs.py /usr/bin/cargo
# Usage: ./buildsystem/cargo-rustc-static-libs.py /usr/bin/cargo --target=x86_64-unknown-linux-gnu
#
# The result is then printed to the standard output.
import os, sys, json, subprocess, tempfile, argparse
NATIVE_STATIC_LIBS="native-static-libs"
parser = argparse.ArgumentParser()
parser.add_argument("cargo_cmds", nargs=argparse.REMAINDER)
args = parser.parse_args()
cargo_argv = args.cargo_cmds
cargo_argv.append("rustc")
cargo_argv.append("--message-format=json")
cargo_argv.append("--crate-type=staticlib")
cargo_argv.append("--quiet")
cargo_argv.append("--")
cargo_argv.append("--print=native-static-libs")
with tempfile.TemporaryDirectory() as tmpdir:
os.chdir(tmpdir)
with open("Cargo.toml", "w") as cargo_toml:
cargo_toml.write("""
[package]
name = "native-static-libs"
version = "0.0.0"
[lib]
path = "lib.rs"
""")
with open("lib.rs", "w") as lib_rs:
lib_rs.write("#![allow(dead_code)] fn main(){}")
# Execute the cargo build and redirect stdout (and not stderr)
cargo_r = subprocess.run(cargo_argv, stdout=subprocess.PIPE)
# We don't use `check=True in run because it raise an execption
# and outputing a python traceback isn't useful at all.
#
# We also exit here so that the output o tmp dir is not cleared when
# there is an error.
if cargo_r.returncode != 0:
print("command: {cargo_argv}", file=sys.stderr)
print("cwd: {tmpdir}", file=sys.stderr)
sys.exit(cargo_r.returncode)
# Get the jsons output
cargo_stdout = cargo_r.stdout.decode('utf-8')
cargo_jsons = [json.loads(line) for line in cargo_stdout.splitlines()]
# Print the last message with a `NATIVE_STATIC_LIBS` message
for j in reversed(cargo_jsons):
if j["reason"] == "compiler-message":
msg = j["message"]["message"]
if msg.startswith(NATIVE_STATIC_LIBS):
print(msg[len(NATIVE_STATIC_LIBS + ": "):])
......@@ -53,6 +53,9 @@ vlc_about = custom_target('vlc_about.h',
'@INPUT2@',
'@OUTPUT@'])
cargo_rustc_static_libs = find_program('buildsystem/cargo-rustc-static-libs.py')
cargo_output = find_program('buildsystem/cargo-output.py')
add_project_arguments('-DHAVE_CONFIG_H=1', language: ['c', 'cpp', 'objc'])
# If building with contribs, read the relevant paths from the machine file
......
......@@ -70,6 +70,11 @@ option('extra_rust_flags',
value : [],
description : 'Extra RUSTFLAGS to be passed to the compiler when compiling Rust VLC modules')
option('vendored_rust_deps',
type : 'string',
value : 'no',
description : 'Should use vendored sources: `no`, `yes` or PATH_TO_VENDORED_SOURCES')
# TODO: Missing pdb option, this should probably be solved in meson itself
# TODO: Missing ssp option
......
......@@ -3,6 +3,7 @@ resolver = "2"
members = []
[workspace.dependencies]
vlcrs-core = { path = "../src/rust/vlcrs-core" }
vlcrs-macros = { path = "../src/rust/vlcrs-macros" }
vlcrs-messages = { path = "../src/rust/vlcrs-messages" }
vlcrs-plugin = { path = "../src/rust/vlcrs-plugin" }
......@@ -13,6 +13,37 @@ TESTS =
dist_noinst_SCRIPTS = module.rc.in
EXTRA_LTLIBRARIES =
if HAVE_RUST
LIBTOOL_CARGO_EXE = $(abs_srcdir)/libtool_cargo.sh
CARGO_BUILD_ARGS = --target=@RUST_TARGET@ --release \
--crate-type=staticlib
RUSTFLAGS = -C panic=abort -C opt-level=z
if !HAVE_DYNAMIC_PLUGINS
RUSTFLAGS += --cfg vlc_static_plugins
endif
LIBTOOL_CARGO = \
TARGET_CC=$(CC) TARGET_AR=$(AR) \
TARGET_CFLAGS="$(CFLAGS)" \
RUSTTARGET="@RUST_TARGET@" \
RUSTFLAGS="${RUSTFLAGS}" \
CARGO_TARGET_DIR="target-rust" \
LIBTOOL="$(LIBTOOL)" \
$(LIBTOOL_CARGO_EXE) $(CARGO) rustc $(CARGO_BUILD_ARGS)
CARGO_PLUGINS_INV = ${LTLIBRARIES:%rs_plugin.la=%rs_plugin}
CARGO_PLUGINS_CUT = ${CARGO_PLUGINS_INV:%.la=}
CARGO_PLUGINS = ${CARGO_PLUGINS_CUT:%=%.la}
CARGO_DEPS = ${CARGO_PLUGINS:%_plugin.la=${top_builddir}/modules/.libs/%.d}
-include $(CARGO_DEPS)
endif
include common.am
include access/Makefile.am
include access/http/Makefile.am
......
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2022 Loïc Branstett <loic@videolabs.io>
# Copyright (C) 2024 Alexandre Janniaux <ajanni@videolabs.io>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# This script generate a libtool convinence library from a Cargo (Rust project)
set -e # Automaticly exit on error
: "${LIBTOOL:="../libtool"}"
CFGS=
CARGO_RUSTC_CMD=
while test $# -gt 2; do
case "$1" in
--cfg)
CFGS="${CFGS} --cfg $2"
shift; shift;
;;
*)
CARGO_RUSTC_CMD="${CARGO_RUSTC_CMD} $1"
shift;
;;
esac
done
if [ $# -lt 2 ]; then
echo "Invalid usage"
exit 1
fi
MODULE_PROJECT_DIR=$1
LT_CONVENIENCE=$2
# Build the project a first time without anything specitial)
$CARGO_RUSTC_CMD --manifest-path="$MODULE_PROJECT_DIR/Cargo.toml" -- ${CFGS}
# "Build" the project a second time and fetch the native-static-libs to link with
NATIVE_STATIC_LIBS=$($CARGO_RUSTC_CMD --manifest-path="$MODULE_PROJECT_DIR/Cargo.toml" --quiet -- ${CFGS} --print native-static-libs 2>&1 | grep "native-static-libs" | sed "s/note: native-static-libs://" | sed "s/-lvlccore//")
STATIC_LIB_NAME=$(echo $LT_CONVENIENCE | sed "s/\.la/\.a/")
STATIC_LIB_DEP=$(echo $LT_CONVENIENCE | sed "s/\.la/\.d/")
CARGO_STATIC_LIB_PATH="$CARGO_TARGET_DIR/$RUSTTARGET/release/$STATIC_LIB_NAME"
CARGO_STATIC_DEP_PATH="$CARGO_TARGET_DIR/$RUSTTARGET/release/$STATIC_LIB_DEP"
LT_VERSION=$(${LIBTOOL} --version | grep "libtool")
cat <<EOF > $LT_CONVENIENCE
# $LT_CONVENIENCE - a libtool library file
# Generated by $LT_VERSION
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='$STATIC_LIB_NAME'
# Linker flags that cannot go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' $NATIVE_STATIC_LIBS'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information
current=0
age=0
revision=0
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir=''
EOF
mkdir -p "./.libs"
ln -sf "../$LT_CONVENIENCE" "./.libs/$LT_CONVENIENCE"
cp "$CARGO_STATIC_LIB_PATH" "./.libs/$STATIC_LIB_NAME"
printf "%s" "$LT_CONVENIENCE:" > "./.libs/$STATIC_LIB_DEP"
cat "$CARGO_STATIC_DEP_PATH" | cut -d ':' -f2 >> "./.libs/$STATIC_LIB_DEP"
......@@ -199,9 +199,12 @@ rsvg_dep = dependency('librsvg-2.0', version: '>= 2.9.0', required: get_option('
libgcrypt_dep = dependency('libgcrypt',
version: '>= 1.6.0',
required: get_option('libgcrypt'))
# Rust support
cargo_bin = find_program('cargo', required: get_option('rust'))
# Array that holds all enabled VLC module dicts
vlc_modules = []
vlc_rust_modules = []
# video chroma modules
subdir('video_chroma')
......@@ -376,3 +379,163 @@ foreach module : vlc_modules
module['name']: module
}
endforeach
# Rust/cargo common handling code
if get_option('rust').enabled()
rust_optimization_args = {
'plain': [],
'0': [],
'g': ['-C', 'opt-level=0'],
'1': ['-C', 'opt-level=1'],
'2': ['-C', 'opt-level=2'],
'3': ['-C', 'opt-level=3'],
's': ['-C', 'opt-level=s'],
}
print_static_libs_rustc = run_command([cargo_rustc_static_libs, cargo_bin],
check: true, capture: true)
rust_common_link_args = print_static_libs_rustc.stdout().split()
# Do not try to reorder those two operations, they may triger a bug in
# meson where array += element is not equal to array += array
rust_flags = get_option('extra_rust_flags')
rust_flags += rust_optimization_args[get_option('optimization')]
cargo_target_dir = join_paths(meson.current_build_dir(), 'cargo_target')
extra_cargo_args = []
module_cargo_depends = []
if get_option('vendored_rust_deps') != 'no'
if get_option('vendored_rust_deps') == 'yes'
cargo_fetch_deps_tgt = custom_target('cargo_fetch_deps',
capture: false,
console: true,
build_by_default: true,
input: files('Cargo.lock'),
output: 'cargo_vendored_deps',
command: [cargo_bin, 'vendor', '--locked', '--versioned-dirs', '--manifest-path',
files('Cargo.toml'), '@OUTPUT@'],
)
vendored_rust_deps_sources = cargo_fetch_deps_tgt.full_path()
module_cargo_depends = [cargo_fetch_deps_tgt]
else
vendored_rust_deps_sources = get_option('vendored_rust_deps')
endif
extra_cargo_args += ['--offline',
'--config', 'source.crates-io.replace-with="vendored-sources"',
'--config', f'source.vendored-sources.directory="@vendored_rust_deps_sources@"']
endif
vlcrs_core = custom_target('vlcrs_core-cargo',
capture: false,
console: true,
build_by_default: true,
input: files(
'vlcrs-core/Cargo.toml',
'vlcrs-core/src/error.rs',
'vlcrs-core/src/input_item.rs',
'vlcrs-core/src/lib.rs',
'vlcrs-core/src/messages.rs',
'vlcrs-core/src/module/args.rs',
'vlcrs-core/src/module/capi.rs',
'vlcrs-core/src/module.rs',
'vlcrs-core/src/object.rs',
'vlcrs-core/src/tick.rs',
'vlcrs-core/src/url.rs',
'vlcrs-core/sys/build.rs',
'vlcrs-core/sys/Cargo.toml',
'vlcrs-core/sys/src/lib.rs',
'vlcrs-core/sys/wrapper.h',
),
output: 'libvlcrs_core.rlib',
depfile: 'libvlcrs_core.d',
depends: module_cargo_depends,
env: {
'RUSTFLAGS': rust_flags,
'CARGO_TARGET_DIR': cargo_target_dir
},
command: [cargo_output, '--output', '@OUTDIR@', '--depfile',
cargo_bin, 'build', '--locked', extra_cargo_args,
'--manifest-path', files('Cargo.toml'),
'-p', 'vlcrs-core']
)
vlcrs_core_macros = custom_target('vlcrs_core_macros-cargo',
capture: false,
console: true,
build_by_default: true,
input: files(
'vlcrs-core/macros/Cargo.toml',
'vlcrs-core/macros/src/lib.rs',
'vlcrs-core/macros/src/module.rs',
),
depfile: 'libvlcrs_core_macros.d',
output: 'libvlcrs_core_macros.so',
depends: module_cargo_depends,
env: {
'RUSTFLAGS': rust_flags,
'CARGO_TARGET_DIR': cargo_target_dir
},
command: [cargo_output, '--output', '@OUTDIR@', '--depfile',
cargo_bin, 'build', '--locked', extra_cargo_args,
'--manifest-path', files('Cargo.toml'),
'-p', 'vlcrs-core-macros']
)
module_cargo_depends += [vlcrs_core, vlcrs_core_macros]
foreach module : vlc_rust_modules
if not module.has_key('name')
error('Got invalid vlc_rust_modules entry without \'name\' key')
endif
if not module.has_key('sources')
error('The vlc_rust_modules entry for ' + module['name'] + ' has no sources')
endif
if not module.has_key('cargo_toml')
error('The vlc_rust_modules entry for ' + module['name'] + ' has no cargo_toml')
endif
# This list MUST be kept in sync with the keys used below!
valid_dict_keys = [
'name',
'sources',
'cargo_toml',
'link_with',
'link_depends',
'dependencies',
]
foreach key : module.keys()
if key not in valid_dict_keys
error('Invalid key \'@0@\' found in vlc_rust_modules entry for \'@1@\''
.format(key, module['name']))
endif
endforeach
module_cargo = custom_target(module['name'] + '_cargo',
build_by_default: true,
input: module['cargo_toml'],
depends: module_cargo_depends,
depfile: 'lib' + module['name'] + '.d',
output: 'lib' + module['name'] + '.a',
env: {
'RUSTFLAGS': rust_flags,
'CARGO_TARGET_DIR': cargo_target_dir,
},
command: [cargo_output, '--output', '@OUTDIR@', '--depfile',
cargo_bin, 'rustc', '--quiet', '--color=always', '--crate-type=staticlib',
'--locked', extra_cargo_args, '--manifest-path', module['cargo_toml']]
)
library(module['name'] + '_plugin',
# FIXME(meson): `module_cargo` shouldn't be in `link_whole` because it prevents dead code
# elimination but meson doesn't yet have any way of setting the symbols to export and since
# `module_cargo` is an archive file everything is exported so nothing is really.
link_whole: module_cargo,
link_with: module.get('link_with', []),
link_args: [module.get('link_args', []), rust_common_link_args],
link_depends: module.get('link_depends', []),
dependencies: [module.get('dependencies', []), libvlccore_dep],
build_by_default: true,
)
endforeach
endif