aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquietvoid <39477805+quietvoid@users.noreply.github.com>2023-07-02 14:58:32 -0400
committerquietvoid <39477805+quietvoid@users.noreply.github.com>2023-09-02 08:29:41 -0400
commitdc595048c6b74d9a74ff54f32c0a80709346f05f (patch)
tree0afe21c87798909616d2461abc4e874a9ef54495
parentd14ae357712fd9dba32461260797c84f8e26ff2f (diff)
tools/depends: Add Rust toolchain, cargo-c and libdovi dependencies
-rw-r--r--tools/depends/native/Makefile5
-rw-r--r--tools/depends/native/cargo-c/CARGO-C-VERSION5
-rw-r--r--tools/depends/native/cargo-c/Makefile38
-rw-r--r--tools/depends/native/rustup/Makefile51
-rw-r--r--tools/depends/native/rustup/RUSTUP-VERSION5
-rw-r--r--tools/depends/target/Makefile2
-rw-r--r--tools/depends/target/libdovi/LIBDOVI-VERSION6
-rw-r--r--tools/depends/target/libdovi/Makefile43
8 files changed, 154 insertions, 1 deletions
diff --git a/tools/depends/native/Makefile b/tools/depends/native/Makefile
index f7a66a30b1..c0489a2119 100644
--- a/tools/depends/native/Makefile
+++ b/tools/depends/native/Makefile
@@ -49,6 +49,10 @@ ifeq ($(OS),linux)
endif
endif
+ifeq ($(OS),android)
+ NATIVE += rustup cargo-c
+endif
+
.PHONY: $(NATIVE) native download $(DOWNLOAD_TARGETS)
all: native
@@ -65,6 +69,7 @@ download: $(DOWNLOAD_TARGETS)
autoconf-archive: autoconf
autoconf: m4
automake: autoconf
+cargo-c: pkg-config openssl rustup
dpkg: automake gettext libtool pkg-config tar
heimdal: libtool
JsonSchemaBuilder: cmake
diff --git a/tools/depends/native/cargo-c/CARGO-C-VERSION b/tools/depends/native/cargo-c/CARGO-C-VERSION
new file mode 100644
index 0000000000..b3737ba01a
--- /dev/null
+++ b/tools/depends/native/cargo-c/CARGO-C-VERSION
@@ -0,0 +1,5 @@
+APPNAME=cargo-c
+VERSION=0.9.21
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+SHA512=855391c29843f8e5f204f889cab16d5d569ebb2174367a8be0d4be3d87141133f98fb7a6750ed0030783a1ff29f358d60c6ca79ed5bb65f61196c726f9c1a0ec
diff --git a/tools/depends/native/cargo-c/Makefile b/tools/depends/native/cargo-c/Makefile
new file mode 100644
index 0000000000..3c12014999
--- /dev/null
+++ b/tools/depends/native/cargo-c/Makefile
@@ -0,0 +1,38 @@
+include ../../Makefile.include CARGO-C-VERSION ../../download-files.include
+DEPS = ../../Makefile.include Makefile CARGO-C-VERSION ../../download-files.include
+
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+
+export PKG_CONFIG_PATH=$(PREFIX)/lib/pkgconfig
+
+APP=$(PLATFORM)/target/release/$(APPNAME)
+
+CARGO_ENV_VARS = RUSTUP_HOME=$(PREFIX)/.rustup \
+ CARGO_HOME=$(PREFIX)/.cargo
+CARGO = $(CARGO_ENV_VARS) $(PREFIX)/bin/cargo
+
+CLEANUP_CMD = [ -e $(PREFIX)/bin/cargo ] \
+ && $(CARGO) uninstall cargo-c || true
+
+all: .installed-$(PLATFORM)
+
+$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
+ rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+ cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(APP): $(PLATFORM)
+ $(CARGO) build --release --manifest-path $(PLATFORM)/Cargo.toml
+
+.installed-$(PLATFORM): $(APP)
+ $(CARGO) install --profile release --path $(PLATFORM)
+
+ touch $@
+
+clean:
+ $(CLEANUP_CMD)
+ rm -f .installed-$(PLATFORM)
+
+distclean::
+ $(CLEANUP_CMD)
+ rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/rustup/Makefile b/tools/depends/native/rustup/Makefile
new file mode 100644
index 0000000000..13d145cccd
--- /dev/null
+++ b/tools/depends/native/rustup/Makefile
@@ -0,0 +1,51 @@
+include ../../Makefile.include RUSTUP-VERSION ../../download-files.include
+DEPS = ../../Makefile.include Makefile RUSTUP-VERSION ../../download-files.include
+
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+
+APP=$(PLATFORM)/bin/$(APPNAME)
+
+export RUSTUP_HOME=$(PREFIX)/.rustup
+export CARGO_HOME=$(PREFIX)/.cargo
+
+RUST_TOOLCHAIN_VERSION=1.71.0
+RUSTUP_ENV_VARS = RUSTUP_HOME=$(PREFIX)/.rustup \
+ CARGO_HOME=$(PREFIX)/.cargo
+RUSTUP = $(RUSTUP_ENV_VARS) $(PREFIX)/bin/rustup
+
+CLEANUP_CMD=[ -e $(PREFIX)/bin/rustup ] \
+ && $(RUSTUP) self uninstall -y \
+ && rm -f $(PREFIX)/bin/rustup \
+ && rm -f $(PREFIX)/bin/cargo || true
+
+all: .installed-$(PLATFORM)
+
+$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
+ rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+ cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(APP): $(PLATFORM)
+ bash $(PLATFORM)/rustup-init.sh -y --no-modify-path \
+ --profile minimal \
+ --default-toolchain=$(RUST_TOOLCHAIN_VERSION)
+
+.installed-$(PLATFORM): $(APP)
+ ln -sf $(CARGO_HOME)/bin/rustup $(PREFIX)/bin/rustup
+ ln -sf $(CARGO_HOME)/bin/cargo $(PREFIX)/bin/cargo
+
+ $(RUSTUP) default $(RUST_TOOLCHAIN_VERSION)
+
+ifeq ($(CROSS_COMPILING),yes)
+ $(RUSTUP) target add $(HOST)
+endif
+
+ touch $@
+
+clean:
+ $(CLEANUP_CMD)
+ rm -f .installed-$(PLATFORM)
+
+distclean::
+ $(CLEANUP_CMD)
+ rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/rustup/RUSTUP-VERSION b/tools/depends/native/rustup/RUSTUP-VERSION
new file mode 100644
index 0000000000..ae487ce2b8
--- /dev/null
+++ b/tools/depends/native/rustup/RUSTUP-VERSION
@@ -0,0 +1,5 @@
+APPNAME=rustup
+VERSION=1.26.0
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+SHA512=bc7cb580640248a601dbafb87c3a9e908b6c687377b4e0f88280576af15527f5837d9463f7831c14b0c274cd3170449e634cd851e0d03ea4ff1d0461d4a941be
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile
index 9a6e449c00..c968d71f8d 100644
--- a/tools/depends/target/Makefile
+++ b/tools/depends/target/Makefile
@@ -76,7 +76,7 @@ endif
ifeq ($(OS),android)
EXCLUDED_DEPENDS = libcec libusb gtest
- DEPENDS += dummy-libxbmc libuuid
+ DEPENDS += dummy-libxbmc libdovi libuuid
PYMODULE_DEPS = dummy-libxbmc
LIBUUID = libuuid
endif
diff --git a/tools/depends/target/libdovi/LIBDOVI-VERSION b/tools/depends/target/libdovi/LIBDOVI-VERSION
new file mode 100644
index 0000000000..6b6d6ab1fc
--- /dev/null
+++ b/tools/depends/target/libdovi/LIBDOVI-VERSION
@@ -0,0 +1,6 @@
+LIBNAME=libdovi
+VERSION=3.1.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+SHA512=577d5a5916dedbf222150ddb76219325e0e9a7ae91c5978b1b1fd65048d1f548e29aa8ebbbdc836380ec399e2bc105a722515f783be70837dc6403cb34586bb2
+BYPRODUCT=libdovi.a
diff --git a/tools/depends/target/libdovi/Makefile b/tools/depends/target/libdovi/Makefile
new file mode 100644
index 0000000000..2d868d2fde
--- /dev/null
+++ b/tools/depends/target/libdovi/Makefile
@@ -0,0 +1,43 @@
+include ../../Makefile.include LIBDOVI-VERSION ../../download-files.include
+DEPS = ../../Makefile.include Makefile LIBDOVI-VERSION ../../download-files.include
+
+LIBDYLIB=$(PLATFORM)/target/$(HOST)/release/$(BYPRODUCT)
+
+CARGO_ENV_VARS = RUSTUP_HOME=$(NATIVEPREFIX)/.rustup \
+ CARGO_HOME=$(NATIVEPREFIX)/.cargo
+CARGO = $(CARGO_ENV_VARS) $(NATIVEPREFIX)/bin/cargo
+
+CARGO_BASE_OPTS = --manifest-path $(PLATFORM)/dolby_vision/Cargo.toml
+ifeq ($(CROSS_COMPILING),yes)
+ CARGO_BASE_OPTS += --target $(HOST)
+endif
+
+CARGO_BUILD_OPTS = --offline \
+ --frozen \
+ --library-type staticlib \
+ --profile release \
+ --prefix $(PREFIX) \
+ $(CARGO_BASE_OPTS)
+
+all: .installed-$(PLATFORM)
+
+$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
+ rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+ cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ cd $(PLATFORM);
+ $(CARGO) fetch $(CARGO_BASE_OPTS)
+
+$(LIBDYLIB): $(PLATFORM)
+ $(CARGO) cbuild $(CARGO_BUILD_OPTS)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+ $(CARGO) cinstall $(CARGO_BUILD_OPTS)
+
+ touch $@
+
+clean:
+ cd $(PLATFORM); $(CARGO) clean
+ rm -f .installed-$(PLATFORM)
+
+distclean::
+ rm -rf $(PLATFORM) .installed-$(PLATFORM)