Subject: [alpine-aports] [PATCH 1/3] testing/cbindgen: New aport

From: Marian Buschsieweke <[email-masked]>
Date: Fri, 28 Dec 2018 09:00:15 +0100

A tool for generating C bindings to Rust code
https://github.com/eqrion/cbindge

This is a build dependency for firefox
---
 testing/cbindgen/APKBUILD | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 testing/cbindgen/APKBUILD

diff --git a/testing/cbindgen/APKBUILD b/testing/cbindgen/APKBUILD
new file mode 100644
index 0000000000..1db696b678
--- /dev/null
+++ b/testing/cbindgen/APKBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Marian Buschsieweke <[email-masked]>
+pkgname=cbindgen
+pkgver=0.6.7
+pkgrel=0
+pkgdesc="A tool for generating C bindings to Rust code"
+url="https://github.com/eqrion/cbindgen"
+# limited by rust and cargo
+arch="x86_64"
+license="MPL2"
+depends=""
+subpackages="$pkgname-doc"
+makedepends="cargo"
+
+install=""
+source="$pkgname-$pkgver.tar.gz::https://github.com/eqrion/$pkgname/archive/v$pkgver.tar.gz"
+
+builddir="${srcdir}/$pkgname-$pkgver"
+
+build() {
+	cd "$builddir"
+	cargo build --release
+}
+
+check() {
+	cd "$builddir"
+	cargo test --release
+}
+
+package() {
+	cd "$builddir"
+	install -Dt "$pkgdir/usr/bin" target/release/cbindgen
+	install -Dt "$pkgdir/usr/share/doc/$pkgname" -m644 README.md
+}
+
+sha512sums="e14a1a2106892bc1983b1144ccaa766cb9b81894de871e9adfd7e3e3d477767eb9b8ed18c953d88fb64473bb3ab23d5eae4ace0b2d61e499585ee946d103b094  cbindgen-0.6.7.tar.gz"
-- 
2.20.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo Arena <[email-masked]>
Date: Mon, 31 Dec 2018 11:58:10 +0100

Hi,

>  create mode 100644 testing/cbindgen/APKBUILD
while building it downloads a bunch of dependencies:

 Downloading serde v1.0.64
 Downloading tempfile
v3.0.3

 Downloading log
v0.4.1

 Downloading clap
v2.31.2

 Downloading syn
v0.14.1

 Downloading toml
v0.4.6

 Downloading serde_json
v1.0.19

 Downloading libc
v0.2.41

 Downloading rand_core
v0.2.1

 Downloading cfg-if
v0.1.3

 Downloading atty
v0.2.10

 Downloading textwrap
v0.9.0

 Downloading bitflags
v1.0.3

 Downloading proc-macro2
v0.4.4

 Downloading quote
v0.6.3

 Downloading dtoa
v0.4.2

 Downloading itoa
v0.4.1

There's no way for APK to ensure the integrity of the package if the
dependecies are downloaded externally.
We need to package every depencency and possibly disable automatic download
of external ones.

Thank you!

/eo

---

From: Marian Buschsieweke <[email-masked]>
Date: Fri, 28 Dec 2018 09:00:16 +0100

SQLITE_ENABLE_FTS3 is already defined via `-DSQLITE_ENABLE_FTS3` in
`CFLAGS`, however this approach does not work (compile source below to
verify). Adding `--enable-fts3` as parameter did the trick. FTS3 is required
e.g. by Firefox.

	#include <stdio.h>
	#include "sqlite3.h"

	int main(int argc, char **argv){
		if (sqlite3_compileoption_used("SQLITE_ENABLE_FTS3"))
			puts("yes");
		else
			puts("no");

		return 0;
	}
---
 main/sqlite/APKBUILD | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/sqlite/APKBUILD b/main/sqlite/APKBUILD
index 92fbdf247a..e690a80344 100644
--- a/main/sqlite/APKBUILD
+++ b/main/sqlite/APKBUILD
@@ -57,7 +57,8 @@ build() {
 		--enable-threadsafe \
 		--enable-readline \
 		--enable-static \
-		--enable-dynamic-extensions
+		--enable-dynamic-extensions \
+		--enable-fts3
 
 	# rpath removal
 	sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
-- 
2.20.1

---

---

From: Marian Buschsieweke <[email-masked]>
Date: Fri, 28 Dec 2018 09:00:17 +0100

Note: This and the previous version do not work reliable unless
browser.tabs.remote.autostart is set to false in "about:config" :-(
---
 testing/firefox/APKBUILD                     | 13 ++++---------
 testing/firefox/rust-unitialized-field.patch | 19 -------------------
 2 files changed, 4 insertions(+), 28 deletions(-)
 delete mode 100644 testing/firefox/rust-unitialized-field.patch

diff --git a/testing/firefox/APKBUILD b/testing/firefox/APKBUILD
index 37f5f9db0a..05579235c1 100644
--- a/testing/firefox/APKBUILD
+++ b/testing/firefox/APKBUILD
@@ -1,7 +1,7 @@
 # Contributor: William Pitcock <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=firefox
-pkgver=62.0.3
+pkgver=64.0
 _pkgver=$pkgver
 _xulver=$pkgver
 pkgrel=1
@@ -18,6 +18,7 @@ makedepends="
 	bsd-compat-headers
 	bzip2-dev
 	cargo
+	cbindgen
 	clang-dev
 	dbus-glib-dev
 	ffmpeg-dev
@@ -42,6 +43,7 @@ makedepends="
 	nspr-dev
 	nss-dev
 	nss-static
+	nodejs
 	paxmark
 	python3-dev
 	sqlite-dev
@@ -63,13 +65,10 @@ source="https://ftp.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkg
 	fix-tools.patch
 	mallinfo.patch
 
-	fix-arm-atomics-grsec.patch
-	fix-arm-version-detect.patch
 	mozilla-build-arm.patch
 	disable-moz-stackwalk.patch
 	fix-rust-target.patch
 	fix-bug-1261392.patch
-	rust-unitialized-field.patch
 	fix-webrtc-glibcisms.patch
 
 	firefox.desktop
@@ -121,7 +120,6 @@ build() {
 		--enable-default-toolkit=cairo-gtk3 \
 		--enable-official-branding \
 		--enable-optimize="$CFLAGS" \
-		--enable-pie \
 		--enable-startup-notification \
 		--enable-system-ffi \
 		--enable-system-sqlite \
@@ -214,7 +212,7 @@ __EOF__
 	rm -f "$pkgdir"/${_mozappdirdev}/sdk/lib/libxul.so
 }
 
-sha512sums="487bb7791284367158c79cf7918fecf3d598627a6416e679aeb5d22626089aeffe07762fa2389819ba881c90ece1c5a83cf2d85b2def15b8d5ba0ed1c498b527  firefox-62.0.3.source.tar.xz
+sha512sums="1aaabcaf133f76edd1a92037a1a8ca4c6dad2efadc6cd97724d4bf4a5a6af63b662a68f9f8bfc41cf6482b44fbf4bf8943a0e82fd08cf9e2aa219b6a97fff541  firefox-64.0.source.tar.xz
 0b3f1e4b9fdc868e4738b5c81fd6c6128ce8885b260affcb9a65ff9d164d7232626ce1291aaea70132b3e3124f5e13fef4d39326b8e7173e362a823722a85127  stab.h
 2f4f15974d52de4bb273b62a332d13620945d284bbc6fe6bd0a1f58ff7388443bc1d3bf9c82cc31a8527aad92b0cd3a1bc41d0af5e1800e0dcbd7033e58ffd71  fix-fortify-system-wrappers.patch
 09bc32cf9ee81b9cc6bb58ddbc66e6cc5c344badff8de3435cde5848e5a451e0172153231db85c2385ff05b5d9c20760cb18e4138dfc99060a9e960de2befbd5  fix-fortify-inline.patch
@@ -222,13 +220,10 @@ sha512sums="487bb7791284367158c79cf7918fecf3d598627a6416e679aeb5d22626089aeffe07
 a2925045154f4fd34e5fc056656f4f9da100341529e5d4104d249154db0c7863384083f421ce6e47e0f20566a8b20787fa35444c7933c03cd03f96f06dcd4532  fix-toolkit.patch
 b46cb90d4fdd1a925a61e2c6c545489cd542f5d82980c529361c02042eed31d5c26972b5e237c1a020f87ffcfd12736d1f4f6e33eaa83ae156d523c808c718cb  fix-tools.patch
 bdcd1b402d2ec94957ba5d08cbad7b1a7f59c251c311be9095208491a05abb05a956c79f27908e1f26b54a3679387b2f33a51e945b650671ad85c0a2d59a5a29  mallinfo.patch
-ed0d344c66fc8e1cc83a11e9858b32c42e841cbeedd9eb9438811e9fcc3593dc824a8336d00058d55836cedc970aeadd6a82c6dcd7bc0fb746e564d8b478cc6c  fix-arm-atomics-grsec.patch
-015e1ff6dbf920033982b5df95d869a0b7bf56c6964e45e50649ddf46d1ce09563458e45240c3ecb92808662b1300b67507f7af272ba184835d91068a9e7d5b0  fix-arm-version-detect.patch
 e61664bc93eadce5016a06a4d0684b34a05074f1815e88ef2613380d7b369c6fd305fb34f83b5eb18b9e3138273ea8ddcfdcb1084fdcaa922a1e5b30146a3b18  mozilla-build-arm.patch
 4797d2d89ac63a57abb826b8ea9f751314ce66946194033deb9d78c2ff377b88106fd2c7bc5034dc13ad03dd5085b1893c3ccae1a9e63fde35655bb0921f7188  disable-moz-stackwalk.patch
 42cc44fda4b05259b38f055d6f51461746aa89a474cedc5e92fb9d20879da0d12b1b515b273a549e7302cda9c7eddde20d5fdba09853e5c658784ad6d0b20078  fix-rust-target.patch
 a50b412edf9573a0bd04a43578b1c927967a616b73a5995eefb15bfa78fd2bd14e36ec05315a0703f6370ecd524e6bcb012e7285beb1245e9add9b8553acb79e  fix-bug-1261392.patch
-01b48a708cc6bc6e3cd7cc7b16f5137ec344566ac891d699b65e322bc992726072fa14a54cef1a7775799fcbbcf90a6c170107c8524caba3bc311b42d93b7581  rust-unitialized-field.patch
 75b97d59e81e5f1debe6a459b535da704d5a2ac4a57c446d16058fd18db81e22317fcc3ec11b89f569f4de87e8e80ced027c0e72e7f1dd16f6fd0feb6b263919  fix-webrtc-glibcisms.patch
 f3b7c3e804ce04731012a46cb9e9a6b0769e3772aef9c0a4a8c7520b030fdf6cd703d5e9ff49275f14b7d738fe82a0a4fde3bc3219dff7225d5db0e274987454  firefox.desktop
 5dcb6288d0444a8a471d669bbaf61cdb1433663eff38b72ee5e980843f5fc07d0d60c91627a2c1159215d0ad77ae3f115dcc5fdfe87e64ca704b641aceaa44ed  firefox-safe.desktop"
diff --git a/testing/firefox/rust-unitialized-field.patch b/testing/firefox/rust-unitialized-field.patch
deleted file mode 100644
index 67ef3a02ab..0000000000
--- a/testing/firefox/rust-unitialized-field.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./media/audioipc/audioipc/src/cmsg.rs.orig	2018-05-09 22:19:14.748631939 +0200
-+++ ./media/audioipc/audioipc/src/cmsg.rs	2018-05-09 22:19:22.961620862 +0200
-@@ -106,11 +106,11 @@ impl ControlMsgBuilder {
-                 return Err(Error::NoSpace);
-             }
- 
--            let cmsghdr = cmsghdr {
--                cmsg_len: cmsg_len as _,
--                cmsg_level: level,
--                cmsg_type: kind,
--            };
-+            use std::mem;
-+            let mut cmsghdr: cmsghdr =  unsafe { mem::zeroed() };
-+            cmsghdr.cmsg_len = cmsg_len as _;
-+            cmsghdr.cmsg_level = level;
-+            cmsghdr.cmsg_type = kind;
- 
-             let cmsghdr = unsafe {
-                 slice::from_raw_parts(&cmsghdr as *const _ as *const _, mem::size_of::<cmsghdr>())
-- 
2.20.1

---