From 2ea2805e798c12d91a8e012560d1dc365d63ae54 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Mon, 30 Dec 2019 13:55:23 +0100 Subject: [PATCH 01/17] contrib: add emscripten target set toolchain variables in bootstrap and main.mak Co-Author: Etienne Brateau --- contrib/bootstrap | 3 +++ contrib/src/main.mak | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/contrib/bootstrap b/contrib/bootstrap index 5ed5f6f25d..54ced964bc 100755 --- a/contrib/bootstrap +++ b/contrib/bootstrap @@ -344,6 +344,9 @@ case "${OS}" in *nacl*) add_make_enabled "HAVE_NACL" ;; + *emscripten*) + add_make_enabled "HAVE_EMSCRIPTEN" + ;; esac # diff --git a/contrib/src/main.mak b/contrib/src/main.mak index f008b20a99..5f7bdf5999 100644 --- a/contrib/src/main.mak +++ b/contrib/src/main.mak @@ -129,6 +129,15 @@ EXTRA_CFLAGS += -fno-stack-check XCODE_FLAGS += OTHER_CFLAGS=-fno-stack-check endif +ifdef HAVE_EMSCRIPTEN +CC := emcc +CXX := em++ +LD := emcc +AR := emar +RANLIB := emranlib +CFLAGS="-pthread" +endif + ifdef HAVE_MACOSX EXTRA_CXXFLAGS += -stdlib=libc++ ifeq ($(ARCH),x86_64) -- GitLab From 5656c4de3ecbb627e3af3e9e11cc06b5fd222257 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 4 Sep 2019 19:35:17 +0200 Subject: [PATCH 02/17] contrib: add ffmpeg configuration options for wasm-emscripten We need to specify the pthread flag for compilation and linking, otherwise tests will fail. --- ...001-configure-add-emscripten-support.patch | 33 +++++++++++++++++++ contrib/src/ffmpeg/rules.mak | 6 ++++ 2 files changed, 39 insertions(+) create mode 100644 contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch diff --git a/contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch b/contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch new file mode 100644 index 0000000000..cb8471c90e --- /dev/null +++ b/contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch @@ -0,0 +1,33 @@ +From da7782c47f1f3d84eefb4ccce1c95e40d3b65fde Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Tue, 13 Aug 2019 21:14:56 +0200 +Subject: [PATCH 1/1] configure: add emscripten support + +--- + configure | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/configure b/configure +index 7cea9d4d73..bafcbc87fc 100755 +--- a/configure ++++ b/configure +@@ -4239,6 +4239,7 @@ fi + exesuf() { + case $1 in + mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;; ++ emscripten) echo .js ;; + esac + } + +@@ -5428,6 +5429,8 @@ case $target_os in + ;; + minix) + ;; ++ emscripten) ++ ;; + none) + ;; + *) +-- +2.23.0 + diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak index 187d513aa1..371b766542 100644 --- a/contrib/src/ffmpeg/rules.mak +++ b/contrib/src/ffmpeg/rules.mak @@ -216,6 +216,11 @@ ifdef HAVE_NACL FFMPEGCONF+=--disable-inline-asm --disable-asm --target-os=linux endif +ifdef HAVE_EMSCRIPTEN +FFMPEGCONF+=--target-os=emscripten --arch=wasm32 --ranlib=emranlib \ + --extra-ldflags="-pthread" --extra-ldexeflags="-pthread" +endif + # Build PKGS += ffmpeg ifeq ($(call need_pkg,"libavcodec >= $(FFMPEG_LAVC_MIN) libavformat >= 53.21.0 libswscale"),) @@ -246,6 +251,7 @@ endif ifdef USE_LIBAV $(APPLY) $(SRC)/ffmpeg/libav_gsm.patch endif + $(APPLY) $(SRC)/ffmpeg/0001-configure-add-emscripten-support.patch $(MOVE) .ffmpeg: ffmpeg -- GitLab From df58b51a5cd7877995ca4c41ae189dee9514c573 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 13 May 2020 23:49:00 +0200 Subject: [PATCH 03/17] contrib: update tremor download link svn and git instances seem to be have been taken down in favor of gitlab. This patch also deletes overwriting ogg headers (because of 8886a280 in tremor). --- contrib/src/tremor/rules.mak | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/contrib/src/tremor/rules.mak b/contrib/src/tremor/rules.mak index a517a79093..6669ff155a 100644 --- a/contrib/src/tremor/rules.mak +++ b/contrib/src/tremor/rules.mak @@ -1,25 +1,23 @@ # tremor (fixed-point Vorbis) +TREMOR_URL := https://gitlab.xiph.org/xiph/tremor.git +TREMOR_HASH := b56ffce0 + ifndef HAVE_FPU PKGS += tremor endif -$(TARBALLS)/tremor-svn.tar.xz: - rm -Rf tremor-svn - $(SVN) export http://svn.xiph.org/trunk/Tremor tremor-svn - tar cvJ tremor-svn > $@ +$(TARBALLS)/tremor-git.tar.xz: + $(call download_git,$(TREMOR_URL),master,$(TREMOR_HASH)) -.sum-tremor: tremor-svn.tar.xz +.sum-tremor: tremor-git.tar.xz $(warning Integrity check skipped.) touch $@ -tremor: tremor-svn.tar.xz .sum-tremor +tremor: tremor-git.tar.xz .sum-tremor # Stuff that does not depend on libogg $(UNPACK) $(APPLY) $(SRC)/tremor/tremor.patch - rm -f tremor-svn/ogg.h tremor-svn/os_types.h - echo '#include ' > tremor-svn/ogg.h - echo '#include ' > tremor-svn/os_types.h $(MOVE) DEPS_tremor = ogg $(DEPS_ogg) -- GitLab From d172fb00dd5976bbccd13d39fcdd73846cd6803e Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Tue, 19 May 2020 13:24:42 +0000 Subject: [PATCH 04/17] contrib: add emscripten support for openjpeg --- contrib/src/openjpeg/emscripten.patch | 33 +++++++++++++++++++++++++++ contrib/src/openjpeg/rules.mak | 1 + 2 files changed, 34 insertions(+) create mode 100644 contrib/src/openjpeg/emscripten.patch diff --git a/contrib/src/openjpeg/emscripten.patch b/contrib/src/openjpeg/emscripten.patch new file mode 100644 index 0000000000..72645cf3c7 --- /dev/null +++ b/contrib/src/openjpeg/emscripten.patch @@ -0,0 +1,33 @@ +From 6f0ce2b2da4b50aa12c7e332934edbde54a75657 Mon Sep 17 00:00:00 2001 +From: mehdi +Date: Tue, 19 May 2020 13:18:08 +0000 +Subject: [PATCH 1/1] add emscripten support + +TEST_BIG_ENDIAN needs to be included from the emscripten toolchain, +the one in CMake will fail. +--- + CMakeLists.txt | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3ea2424a..23c090e1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -161,7 +161,14 @@ endif() + + #----------------------------------------------------------------------------- + # Big endian test: ++if (CMAKE_SYSTEM_NAME MATCHES "Emscripten") ++include ($ENV{EMSDK}/upstream/emscripten/cmake/Modules/TestBigEndian.cmake) ++else() + include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) ++endif() ++ ++ ++ + TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN) + + #----------------------------------------------------------------------------- +-- +2.26.2 + diff --git a/contrib/src/openjpeg/rules.mak b/contrib/src/openjpeg/rules.mak index 184c484f00..51d262f509 100644 --- a/contrib/src/openjpeg/rules.mak +++ b/contrib/src/openjpeg/rules.mak @@ -22,6 +22,7 @@ endif $(APPLY) $(SRC)/openjpeg/install.patch $(APPLY) $(SRC)/openjpeg/pic.patch $(APPLY) $(SRC)/openjpeg/openjp2_pthread.patch + $(APPLY) $(SRC)/openjpeg/emscripten.patch $(call pkg_static,"./src/lib/openjp2/libopenjp2.pc.cmake.in") $(MOVE) -- GitLab From 8ded59b4bff4f740a302e3755ca2c267d39acd41 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Tue, 19 May 2020 13:34:48 +0000 Subject: [PATCH 05/17] contrib: add CMAKE_SYSTEM_NAME --- contrib/src/main.mak | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/src/main.mak b/contrib/src/main.mak index 5f7bdf5999..ec5255f424 100644 --- a/contrib/src/main.mak +++ b/contrib/src/main.mak @@ -565,6 +565,9 @@ endif ifdef HAVE_DARWIN_OS CMAKE_SYSTEM_NAME = Darwin endif +ifdef HAVE_EMSCRIPTEN +CMAKE_SYSTEM_NAME = Emscripten +endif ifdef HAVE_ANDROID CFLAGS += -DANDROID_NATIVE_API_LEVEL=$(ANDROID_API) -- GitLab From 83392bdfbb06d3f30da1ccd69ccd6ab6d25ff801 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Tue, 7 Jan 2020 11:57:22 +0100 Subject: [PATCH 06/17] Add meson_system_name for emscripten --- contrib/src/main.mak | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/src/main.mak b/contrib/src/main.mak index ec5255f424..d6b6959339 100644 --- a/contrib/src/main.mak +++ b/contrib/src/main.mak @@ -636,12 +636,16 @@ else ifdef HAVE_LINUX # android has also system = linux and defines HAVE_LINUX MESON_SYSTEM_NAME = linux +else +ifdef HAVE_EMSCRIPTEN + MESON_SYSTEM_NAME = emscripten else $(error "No meson system name known for this target") endif endif endif endif +endif crossfile.meson: $(SRC)/gen-meson-crossfile.py $(HOSTVARS_MESON) \ -- GitLab From 2ec04ae4364ccbd18a4f450433d697a9fd847073 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Mon, 8 Jun 2020 14:40:22 +0000 Subject: [PATCH 07/17] contrib: fix fontconfig compilation --- .../0001-emscripten-update-config.sub.patch | 872 ++++++++++++++++++ .../0002-emscripten-fix-compilation.patch | 60 ++ contrib/src/fontconfig/rules.mak | 4 + 3 files changed, 936 insertions(+) create mode 100644 contrib/src/fontconfig/0001-emscripten-update-config.sub.patch create mode 100644 contrib/src/fontconfig/0002-emscripten-fix-compilation.patch diff --git a/contrib/src/fontconfig/0001-emscripten-update-config.sub.patch b/contrib/src/fontconfig/0001-emscripten-update-config.sub.patch new file mode 100644 index 0000000000..baa2afc317 --- /dev/null +++ b/contrib/src/fontconfig/0001-emscripten-update-config.sub.patch @@ -0,0 +1,872 @@ +From 875bba5978e3973295c32cd549f87a1fe42579f8 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Mon, 8 Jun 2020 14:29:21 +0000 +Subject: [PATCH 1/2] emscripten: update config.sub + +--- + config.sub | 325 +++++++++++++++++++++++++++-------------------------- + 1 file changed, 166 insertions(+), 159 deletions(-) + +diff --git a/config.sub b/config.sub +index 20f7cf2..a5002b2 100755 +--- a/config.sub ++++ b/config.sub +@@ -1,8 +1,8 @@ + #! /bin/sh + # Configuration validation subroutine script. +-# Copyright 1992-2018 Free Software Foundation, Inc. ++# Copyright 1992-2017 Free Software Foundation, Inc. + +-timestamp='2018-05-05' ++timestamp='2017-04-02' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -15,7 +15,7 @@ timestamp='2018-05-05' + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, see . ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a +@@ -33,7 +33,7 @@ timestamp='2018-05-05' + # Otherwise, we print the canonical config type on stdout and succeed. + + # You can get the latest version of this script from: +-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases +@@ -57,7 +57,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + + Canonicalize a configuration name. + +-Options: ++Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit +@@ -67,7 +67,7 @@ Report bugs and patches to ." + version="\ + GNU config.sub ($timestamp) + +-Copyright 1992-2018 Free Software Foundation, Inc. ++Copyright 1992-2017 Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -94,7 +94,7 @@ while test $# -gt 0 ; do + + *local*) + # First pass through any local machine types. +- echo "$1" ++ echo $1 + exit ;; + + * ) +@@ -110,48 +110,28 @@ case $# in + exit 1;; + esac + +-# Spilt fields of configuration type +-IFS="-" read -r field1 field2 field3 field4 <&2 ++ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. +@@ -403,7 +382,7 @@ case $basic_machine in + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ +- | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ ++ | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ +@@ -444,7 +423,6 @@ case $basic_machine in + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ +- | nfp-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ +@@ -483,7 +461,7 @@ case $basic_machine in + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) +- basic_machine=i386-pc ++ basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) +@@ -517,7 +495,7 @@ case $basic_machine in + basic_machine=x86_64-pc + ;; + amd64-*) +- basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl +@@ -562,7 +540,7 @@ case $basic_machine in + os=-linux + ;; + blackfin-*) +- basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) +@@ -570,13 +548,13 @@ case $basic_machine in + os=-cnk + ;; + c54x-*) +- basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) +- basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) +- basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray +@@ -665,7 +643,7 @@ case $basic_machine in + basic_machine=rs6000-bull + os=-bosx + ;; +- dpx2*) ++ dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; +@@ -674,7 +652,7 @@ case $basic_machine in + os=$os"spe" + ;; + e500v[12]-*) +- basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; + ebmon29k) +@@ -766,6 +744,9 @@ case $basic_machine in + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; ++ hppa-next) ++ os=-nextstep3 ++ ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf +@@ -778,26 +759,26 @@ case $basic_machine in + basic_machine=i370-ibm + ;; + i*86v32) +- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` ++ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) +- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` ++ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) +- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` ++ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) +- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` ++ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; +- vsta) ++ i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; +@@ -816,16 +797,19 @@ case $basic_machine in + os=-sysv + ;; + leon-*|leon[3-9]-*) +- basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ++ basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) +- basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; ++ m88k-omron*) ++ basic_machine=m88k-omron ++ ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv +@@ -857,10 +841,10 @@ case $basic_machine in + os=-mint + ;; + mips3*-*) +- basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ++ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) +- basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ++ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k +@@ -879,7 +863,7 @@ case $basic_machine in + os=-msdos + ;; + ms1-*) +- basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc +@@ -921,7 +905,7 @@ case $basic_machine in + basic_machine=v70-nec + os=-sysv + ;; +- next | m*-next) ++ next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) +@@ -966,9 +950,6 @@ case $basic_machine in + nsr-tandem) + basic_machine=nsr-tandem + ;; +- nsv-tandem) +- basic_machine=nsv-tandem +- ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; +@@ -1004,7 +985,7 @@ case $basic_machine in + os=-linux + ;; + parisc-*) +- basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) +@@ -1020,7 +1001,7 @@ case $basic_machine in + basic_machine=i386-pc + ;; + pc98-*) +- basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc +@@ -1035,16 +1016,16 @@ case $basic_machine in + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) +- basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) +- basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) +- basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) +- basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould +@@ -1054,23 +1035,23 @@ case $basic_machine in + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) +- basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) +- basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; +- ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) +- basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm +@@ -1124,10 +1105,17 @@ case $basic_machine in + sequent) + basic_machine=i386-sequent + ;; ++ sh) ++ basic_machine=sh-hitachi ++ os=-hms ++ ;; + sh5el) + basic_machine=sh5le-unknown + ;; +- simso-wrs) ++ sh64) ++ basic_machine=sh64-unknown ++ ;; ++ sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; +@@ -1146,7 +1134,7 @@ case $basic_machine in + os=-sysv4 + ;; + strongarm-* | thumb-*) +- basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ++ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun +@@ -1260,6 +1248,9 @@ case $basic_machine in + basic_machine=a29k-wrs + os=-vxworks + ;; ++ wasm32) ++ basic_machine=wasm32-unknown ++ ;; + w65*) + basic_machine=w65-wdc + os=-none +@@ -1268,9 +1259,6 @@ case $basic_machine in + basic_machine=hppa1.1-winbond + os=-proelf + ;; +- x64) +- basic_machine=x86_64-pc +- ;; + xbox) + basic_machine=i686-pc + os=-mingw32 +@@ -1279,12 +1267,20 @@ case $basic_machine in + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) +- basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ++ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; ++ z8k-*-coff) ++ basic_machine=z8k-unknown ++ os=-sim ++ ;; ++ z80-*-coff) ++ basic_machine=z80-unknown ++ os=-sim ++ ;; + none) + basic_machine=none-none + os=-none +@@ -1313,6 +1309,10 @@ case $basic_machine in + vax) + basic_machine=vax-dec + ;; ++ pdp10) ++ # there are many clones, so DEC is not a safe bet ++ basic_machine=pdp10-unknown ++ ;; + pdp11) + basic_machine=pdp11-dec + ;; +@@ -1322,6 +1322,9 @@ case $basic_machine in + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; ++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) ++ basic_machine=sparc-sun ++ ;; + cydra) + basic_machine=cydra-cydrome + ;; +@@ -1341,7 +1344,7 @@ case $basic_machine in + # Make sure to match an already-canonicalized machine name. + ;; + *) +- echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 ++ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + esac +@@ -1349,10 +1352,10 @@ esac + # Here we canonicalize certain aliases for manufacturers. + case $basic_machine in + *-digital*) +- basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ++ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) +- basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ++ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +@@ -1360,11 +1363,11 @@ esac + + # Decode manufacturer-specific aliases for certain operating systems. + +-if [ x$os != x ] ++if [ x"$os" != x"" ] + then + case $os in +- # First match some system type aliases that might get confused +- # with valid system types. ++ # First match some system type aliases ++ # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux +@@ -1375,19 +1378,18 @@ case $os in + -solaris) + os=-solaris2 + ;; ++ -svr4*) ++ os=-sysv4 ++ ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; +- # es1800 is here to avoid being matched by es* (a different OS) +- -es1800*) +- os=-ose +- ;; +- # Now accept the basic system types. ++ # First accept the basic system types. + # The portable systems comes first. +- # Each alternative MUST end in a * to match a version number. ++ # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ +@@ -1397,26 +1399,25 @@ case $os in + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ +- | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ ++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ +- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ ++ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ +- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ ++ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ +- | -morphos* | -superux* | -rtmk* | -windiss* \ ++ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ +- | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ +- | -midnightbsd*) ++ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1433,12 +1434,12 @@ case $os in + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; +- -sim | -xray | -os68k* | -v88r* \ +- | -windows* | -osx | -abug | -netware* | -os9* \ ++ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ ++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) +- os=`echo "$os" | sed -e 's|mac|macos|'` ++ os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc +@@ -1447,10 +1448,10 @@ case $os in + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) +- os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ++ os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) +- os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ++ os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition +@@ -1461,6 +1462,12 @@ case $os in + -wince*) + os=-wince + ;; ++ -osfrose*) ++ os=-osfrose ++ ;; ++ -osf*) ++ os=-osf ++ ;; + -utek*) + os=-bsd + ;; +@@ -1485,7 +1492,7 @@ case $os in + -nova*) + os=-rtmk-nova + ;; +- -ns2) ++ -ns2 ) + os=-nextstep2 + ;; + -nsk*) +@@ -1507,7 +1514,7 @@ case $os in + -oss*) + os=-sysv3 + ;; +- -svr4*) ++ -svr4) + os=-sysv4 + ;; + -svr3) +@@ -1522,44 +1529,37 @@ case $os in + -ose*) + os=-ose + ;; ++ -es1800*) ++ os=-ose ++ ;; ++ -xenix) ++ os=-xenix ++ ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; ++ -aros*) ++ os=-aros ++ ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; +- -pikeos*) +- # Until real need of OS specific support for +- # particular features comes up, bare metal +- # configurations are quite functional. +- case $basic_machine in +- arm*) +- os=-eabi +- ;; +- *) +- os=-elf +- ;; +- esac +- ;; + -nacl*) + ;; + -ios) + ;; +- -none) ++ -emscripten) ++ os=-emscripten + ;; +- -*-eabi) +- case $basic_machine in +- arm*) +- ;; +- esac ++ -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` +- echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 ++ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; + esac +@@ -1655,6 +1655,9 @@ case $basic_machine in + *-be) + os=-beos + ;; ++ *-haiku) ++ os=-haiku ++ ;; + *-ibm) + os=-aix + ;; +@@ -1694,7 +1697,7 @@ case $basic_machine in + m88k-omron*) + os=-luna + ;; +- *-next) ++ *-next ) + os=-nextstep + ;; + *-sequent) +@@ -1709,6 +1712,9 @@ case $basic_machine in + i370-*) + os=-mvs + ;; ++ *-next) ++ os=-nextstep3 ++ ;; + *-gould) + os=-sysv + ;; +@@ -1818,16 +1824,17 @@ case $basic_machine in + vendor=stratus + ;; + esac +- basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ++ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; + esac + +-echo "$basic_machine$os" ++echo $basic_machine$os + exit + + # Local variables: +-# eval: (add-hook 'before-save-hook 'time-stamp) ++# eval: (add-hook 'write-file-hooks 'time-stamp) + # time-stamp-start: "timestamp='" + # time-stamp-format: "%:y-%02m-%02d" + # time-stamp-end: "'" + # End: ++ +-- +2.26.2 + diff --git a/contrib/src/fontconfig/0002-emscripten-fix-compilation.patch b/contrib/src/fontconfig/0002-emscripten-fix-compilation.patch new file mode 100644 index 0000000000..ae066327ca --- /dev/null +++ b/contrib/src/fontconfig/0002-emscripten-fix-compilation.patch @@ -0,0 +1,60 @@ +From 36417297db5d19af6314392d469cfc6cfac5542a Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Mon, 8 Jun 2020 14:30:25 +0000 +Subject: [PATCH 2/2] emscripten: fix compilation + +--- + src/fccache.c | 4 ++++ + src/fcstat.c | 2 +- + test/test-hash.c | 5 ++++- + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/fccache.c b/src/fccache.c +index 2b60401..aec219b 100644 +--- a/src/fccache.c ++++ b/src/fccache.c +@@ -101,7 +101,11 @@ FcDirCacheCreateUUID (FcChar8 *dir, + ret = FcFalse; + goto bail3; + } ++#if defined (__EMSCRIPTEN__) ++ uuid_generate(uuid); ++#else + uuid_generate_random (uuid); ++#endif + if (force) + hash_add = FcHashTableReplace; + else +diff --git a/src/fcstat.c b/src/fcstat.c +index 5aa1643..b489871 100644 +--- a/src/fcstat.c ++++ b/src/fcstat.c +@@ -384,7 +384,7 @@ FcFStatFs (int fd, FcStatFS *statb) + # endif + # if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) + p = buf.f_fstypename; +-# elif defined(__linux__) ++# elif defined(__linux__) || (__EMSCRIPTEN__) + switch (buf.f_type) + { + case 0x6969: /* nfs */ +diff --git a/test/test-hash.c b/test/test-hash.c +index 7530e82..3a16ba8 100644 +--- a/test/test-hash.c ++++ b/test/test-hash.c +@@ -51,8 +51,11 @@ test_add (Test *test, FcChar8 *key, FcBool replace) + void *u; + FcBool (*hash_add) (FcHashTable *, void *, void *); + FcBool ret = FcFalse; +- ++#if defined (__EMSCRIPTEN__) ++ uuid_generate(uuid); ++#else + uuid_generate_random (uuid); ++#endif + if (replace) + hash_add = FcHashTableReplace; + else +-- +2.26.2 + diff --git a/contrib/src/fontconfig/rules.mak b/contrib/src/fontconfig/rules.mak index 08b6a04cc0..aef6d59186 100644 --- a/contrib/src/fontconfig/rules.mak +++ b/contrib/src/fontconfig/rules.mak @@ -22,6 +22,10 @@ ifdef HAVE_WIN32 $(APPLY) $(SRC)/fontconfig/fontconfig-noxml2.patch endif $(APPLY) $(SRC)/fontconfig/8208f99-fix-static-linking.patch +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/fontconfig/0001-emscripten-update-config.sub.patch + $(APPLY) $(SRC)/fontconfig/0002-emscripten-fix-compilation.patch +endif $(call pkg_static, "fontconfig.pc.in") $(MOVE) -- GitLab From fb797b27d482e15b2a67fc450f6d43718e5c9c5b Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Tue, 9 Jun 2020 08:33:32 +0000 Subject: [PATCH 08/17] contrib: fixup main.mak --- contrib/src/main.mak | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/src/main.mak b/contrib/src/main.mak index d6b6959339..d26ae720e0 100644 --- a/contrib/src/main.mak +++ b/contrib/src/main.mak @@ -130,12 +130,13 @@ XCODE_FLAGS += OTHER_CFLAGS=-fno-stack-check endif ifdef HAVE_EMSCRIPTEN -CC := emcc -CXX := em++ -LD := emcc -AR := emar -RANLIB := emranlib -CFLAGS="-pthread" +CC ?= emcc +CXX ?= em++ +LD ?= emcc +AR ?= emar +RANLIB ?= emranlib +CFLAGS+="-pthread" +CPPFLAGS+="-pthread" endif ifdef HAVE_MACOSX -- GitLab From 13cc4ea4c1a06f9de30ebb8df2864547991cbe28 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Tue, 23 Jun 2020 12:42:02 +0000 Subject: [PATCH 09/17] contrib: fix zvbi support --- .../0001-emscripten-fix-pthread-test.patch | 30 +++++++++++++++++++ contrib/src/zvbi/rules.mak | 3 ++ 2 files changed, 33 insertions(+) create mode 100644 contrib/src/zvbi/0001-emscripten-fix-pthread-test.patch diff --git a/contrib/src/zvbi/0001-emscripten-fix-pthread-test.patch b/contrib/src/zvbi/0001-emscripten-fix-pthread-test.patch new file mode 100644 index 0000000000..8e15a8e3cd --- /dev/null +++ b/contrib/src/zvbi/0001-emscripten-fix-pthread-test.patch @@ -0,0 +1,30 @@ +From 4ab2ddb45a3dee25f4ce1598f06ea52e14b095c9 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Tue, 23 Jun 2020 12:13:21 +0000 +Subject: [PATCH 1/1] emscripten fix pthread test + +--- + configure.in | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/configure.in b/configure.in +index 3cf3857..6f206ae 100644 +--- a/configure.in ++++ b/configure.in +@@ -168,9 +168,11 @@ dnl Check how to link pthreads functions. + dnl (-lpthread on Linux, -pthread on FreeBSD). + dnl + AC_CHECK_LIB(pthread, pthread_create,,[ +- AC_TRY_LINK(, pthread_create();,,[ ++ AC_TRY_LINK([#include ], ++ pthread_create(NULL, NULL, NULL, NULL);,,[ + LDFLAGS="$LDFLAGS -pthread" +- AC_TRY_LINK(, pthread_create();,,[ ++ AC_TRY_LINK([#include ], ++ pthread_create(NULL, NULL, NULL, NULL);,,[ + AC_MSG_ERROR([Unable to link pthread functions]) + ]) + ]) +-- +2.26.2 + diff --git a/contrib/src/zvbi/rules.mak b/contrib/src/zvbi/rules.mak index a329df7f90..95da0436f4 100644 --- a/contrib/src/zvbi/rules.mak +++ b/contrib/src/zvbi/rules.mak @@ -27,6 +27,9 @@ endif $(APPLY) $(SRC)/zvbi/zvbi-fix-clang-support.patch ifdef HAVE_ANDROID $(APPLY) $(SRC)/zvbi/zvbi-android.patch +endif +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/zvbi/0001-emscripten-fix-pthread-test.patch endif $(MOVE) -- GitLab From a4060177e722eae88142ca9ed521e38490db667c Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Tue, 23 Jun 2020 18:05:07 +0000 Subject: [PATCH 10/17] contrib: fix taglib --- ...1-add-wchar_t-support-for-emscripten.patch | 46 +++++++++++++++++++ contrib/src/taglib/rules.mak | 3 ++ 2 files changed, 49 insertions(+) create mode 100644 contrib/src/taglib/0001-add-wchar_t-support-for-emscripten.patch diff --git a/contrib/src/taglib/0001-add-wchar_t-support-for-emscripten.patch b/contrib/src/taglib/0001-add-wchar_t-support-for-emscripten.patch new file mode 100644 index 0000000000..c851d5e266 --- /dev/null +++ b/contrib/src/taglib/0001-add-wchar_t-support-for-emscripten.patch @@ -0,0 +1,46 @@ +From e47ce105a96fbf6558732a24a0d3949d93763540 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Tue, 23 Jun 2020 17:48:56 +0000 +Subject: [PATCH 1/1] add wchar_t support for emscripten + +--- + ConfigureChecks.cmake | 4 ++++ + taglib/toolkit/unicode.h | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake +index ee4fdc2..3ba17bc 100644 +--- a/ConfigureChecks.cmake ++++ b/ConfigureChecks.cmake +@@ -20,9 +20,13 @@ if(NOT ${SIZEOF_LONGLONG} EQUAL 8) + endif() + + check_type_size("wchar_t" SIZEOF_WCHAR_T) ++#checking an empty variable will stop the compilation ++#we need it to continue, so that we can add wchar_t support fot he platform ++if(HAVE_${SIZEOF_WCHAR_T}) + if(${SIZEOF_WCHAR_T} LESS 2) + message(FATAL_ERROR "TagLib requires that wchar_t is sufficient to store a UTF-16 char.") + endif() ++endif() + + check_type_size("float" SIZEOF_FLOAT) + if(NOT ${SIZEOF_FLOAT} EQUAL 4) +diff --git a/taglib/toolkit/unicode.h b/taglib/toolkit/unicode.h +index d3a869f..f1ea338 100644 +--- a/taglib/toolkit/unicode.h ++++ b/taglib/toolkit/unicode.h +@@ -106,6 +106,10 @@ + bit mask & shift operations. + ------------------------------------------------------------------------ */ + ++#if defined(__EMSCRIPTEN__) ++# include ++#endif ++ + /* Some fundamental constants */ + #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD + #define UNI_MAX_BMP (UTF32)0x0000FFFF +-- +2.26.2 + diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak index b967b7d54f..b34261e18b 100644 --- a/contrib/src/taglib/rules.mak +++ b/contrib/src/taglib/rules.mak @@ -19,6 +19,9 @@ taglib: taglib-$(TAGLIB_VERSION).tar.gz .sum-taglib $(APPLY) $(SRC)/taglib/0002-use-GetFileInformationByHandleEx-on-newer-builds-of-.patch $(APPLY) $(SRC)/taglib/0003-don-t-use-CreateFile-in-UWP-builds.patch $(APPLY) $(SRC)/taglib/use_resolvers_on_streams.patch +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/taglib/0001-add-wchar_t-support-for-emscripten.patch +endif $(MOVE) .taglib: taglib toolchain.cmake -- GitLab From 9504c66107408f8342f042fa35f893cdddb0c092 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 24 Jun 2020 09:31:51 +0000 Subject: [PATCH 11/17] contrib: fix speex configuration --- .../0001-add-emscripten-to-config.sub.patch | 35 +++++++++++++++++++ contrib/src/speex/rules.mak | 1 + 2 files changed, 36 insertions(+) create mode 100644 contrib/src/speex/0001-add-emscripten-to-config.sub.patch diff --git a/contrib/src/speex/0001-add-emscripten-to-config.sub.patch b/contrib/src/speex/0001-add-emscripten-to-config.sub.patch new file mode 100644 index 0000000000..a5ddf48e72 --- /dev/null +++ b/contrib/src/speex/0001-add-emscripten-to-config.sub.patch @@ -0,0 +1,35 @@ +From 5db977452cac1f73e83c12db382c739b2dd790bc Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 24 Jun 2020 09:20:47 +0000 +Subject: [PATCH 1/1] add emscripten to config.sub + +--- + config.sub | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/config.sub b/config.sub +index 1acc966..953b973 100755 +--- a/config.sub ++++ b/config.sub +@@ -2,7 +2,7 @@ + # Configuration validation subroutine script. + # Copyright 1992-2015 Free Software Foundation, Inc. + +-timestamp='2015-08-20' ++timestamp='2020-06-24' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -1531,6 +1531,9 @@ case $os in + ;; + -nacl*) + ;; ++ -emscripten) ++ os=-emscripten ++ ;; + -none) + ;; + *) +-- +2.26.2 + diff --git a/contrib/src/speex/rules.mak b/contrib/src/speex/rules.mak index 8f4cabef68..0e0b280cb8 100644 --- a/contrib/src/speex/rules.mak +++ b/contrib/src/speex/rules.mak @@ -15,6 +15,7 @@ $(TARBALLS)/speex-$(SPEEX_VERSION).tar.gz: speex: speex-$(SPEEX_VERSION).tar.gz .sum-speex $(UNPACK) + $(APPLY) $(SRC)/speex/0001-add-emscripten-to-config.sub.patch $(MOVE) SPEEX_CONF := --disable-binaries -- GitLab From 3923d9e53b2276404959f815e35260839e66621d Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 1 Jul 2020 18:23:33 +0000 Subject: [PATCH 12/17] contrib: wip fix soxr Will need to revert when CMAKE cross compilation will be fixed --- ...temporary-fix-for-TestBigEndian-path.patch | 28 +++++++++++++++++++ contrib/src/soxr/rules.mak | 1 + 2 files changed, 29 insertions(+) create mode 100644 contrib/src/soxr/0001-wip-temporary-fix-for-TestBigEndian-path.patch diff --git a/contrib/src/soxr/0001-wip-temporary-fix-for-TestBigEndian-path.patch b/contrib/src/soxr/0001-wip-temporary-fix-for-TestBigEndian-path.patch new file mode 100644 index 0000000000..3bd3915644 --- /dev/null +++ b/contrib/src/soxr/0001-wip-temporary-fix-for-TestBigEndian-path.patch @@ -0,0 +1,28 @@ +From fe7ddaecfd75a244b90af64a8e4d7433add7adc5 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 1 Jul 2020 16:48:46 +0000 +Subject: [PATCH 1/1] wip: temporary fix for TestBigEndian path + +--- + CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 10d6fd6..d247b2c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -90,7 +90,11 @@ include (CheckFunctionExists) + include (CheckIncludeFiles) + include (CheckLibraryExists) + include (SetSystemProcessor) ++if (CMAKE_SYSTEM_NAME MATCHES "Emscripten") ++include ($ENV{EMSDK}/upstream/emscripten/cmake/Modules/TestBigEndian.cmake) ++else() + include (TestBigEndian) ++endif() + + set_system_processor () + +-- +2.26.2 + diff --git a/contrib/src/soxr/rules.mak b/contrib/src/soxr/rules.mak index a26557b6fb..e49f55a3db 100644 --- a/contrib/src/soxr/rules.mak +++ b/contrib/src/soxr/rules.mak @@ -21,6 +21,7 @@ soxr: soxr-$(SOXR_VERSION)-Source.tar.xz .sum-soxr $(APPLY) $(SRC)/soxr/0003-add-aarch64-support.patch $(APPLY) $(SRC)/soxr/0004-arm-fix-SIGILL-when-doing-divisions-on-some-old-arch.patch $(APPLY) $(SRC)/soxr/find_ff_pkgconfig.patch + $(APPLY) $(SRC)/soxr/0001-wip-temporary-fix-for-TestBigEndian-path.patch $(call pkg_static,"src/soxr.pc.in") $(MOVE) -- GitLab From 5b4e877de2acca2ef60eb9da92f41dd6da02477a Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 1 Jul 2020 19:56:52 +0000 Subject: [PATCH 13/17] contrib: add configure wrapper to fix exe_suffix issue --- contrib/src/sidplay2/rules.mak | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/src/sidplay2/rules.mak b/contrib/src/sidplay2/rules.mak index 0a303363db..cbbf903398 100644 --- a/contrib/src/sidplay2/rules.mak +++ b/contrib/src/sidplay2/rules.mak @@ -41,7 +41,11 @@ sidplay-libs: sidplay-libs-$(SID_VERSION).tar.gz .sum-sidplay2 do \ (cd $ Date: Wed, 1 Jul 2020 20:01:30 +0000 Subject: [PATCH 14/17] contrib: add emscripten support for postproc --- contrib/src/postproc/rules.mak | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/src/postproc/rules.mak b/contrib/src/postproc/rules.mak index 655acd5217..603ca91f77 100644 --- a/contrib/src/postproc/rules.mak +++ b/contrib/src/postproc/rules.mak @@ -107,6 +107,10 @@ ifdef HAVE_NACL POSTPROCCONF += --target-os=linux endif +ifdef HAVE_EMSCRIPTEN +POSTPROCCONF += --target-os=none --arch=wasm32 +endif + # Build ifdef GPL -- GitLab From 2cdb068f39c5f1ef55ab7d83a80700ea97659a0a Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 1 Jul 2020 20:29:42 +0000 Subject: [PATCH 15/17] wip: fix libplacebo for emscripten --- ...ble-osdependent-check-for-emscripten.patch | 26 +++++++++++++++++++ contrib/src/libplacebo/rules.mak | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 contrib/src/libplacebo/0001-wip-disable-osdependent-check-for-emscripten.patch diff --git a/contrib/src/libplacebo/0001-wip-disable-osdependent-check-for-emscripten.patch b/contrib/src/libplacebo/0001-wip-disable-osdependent-check-for-emscripten.patch new file mode 100644 index 0000000000..37a55efd82 --- /dev/null +++ b/contrib/src/libplacebo/0001-wip-disable-osdependent-check-for-emscripten.patch @@ -0,0 +1,26 @@ +From 1dc3fb8cb3855fd7a1737bc97eab427363c5e476 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 1 Jul 2020 20:26:20 +0000 +Subject: [PATCH 1/1] wip: disable osdependent check for emscripten + +--- + src/meson.build | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/meson.build b/src/meson.build +index 9e38f53..93de041 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -66,7 +66,8 @@ else + cxx.find_library('glslang', dirs: prefix_lib, required: glslang_req), + cxx.find_library('HLSL', dirs: prefix_lib, required: glslang_req), + cxx.find_library('OGLCompiler', dirs: prefix_lib, required: glslang_req), +- cxx.find_library('OSDependent', dirs: prefix_lib, required: glslang_req), ++ # OSDependent is not available on the contrib version of glslang, it will be added later ++ # cxx.find_library('OSDependent', dirs: prefix_lib, required: glslang_req), + cxx.find_library('SPIRV', dirs: prefix_lib, required: glslang_req), + cxx.find_library('SPVRemapper', dirs: prefix_lib, required: glslang_req), + ] +-- +2.26.2 + diff --git a/contrib/src/libplacebo/rules.mak b/contrib/src/libplacebo/rules.mak index 1f34691824..83ae48f4dd 100644 --- a/contrib/src/libplacebo/rules.mak +++ b/contrib/src/libplacebo/rules.mak @@ -28,6 +28,9 @@ $(TARBALLS)/$(PLACEBO_ARCHIVE): libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo $(UNPACK) $(APPLY) $(SRC)/libplacebo/0001-meson-fix-glslang-search-path.patch +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/libplacebo/0001-wip-disable-osdependent-check-for-emscripten.patch +endif $(MOVE) .libplacebo: libplacebo crossfile.meson -- GitLab From f8b964f39fa8effd0e55d37429d73cde8f6c71ed Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 8 Jul 2020 15:49:25 +0000 Subject: [PATCH 16/17] wip: fix gettext there is a patch that needs to be removed, I couldn't assume argz functions are not available, I added a temporary ifdef instead. --- ...1-wip-fix-argz-erroneous-test-result.patch | 29 ++++ ...to-fix-erroneous-argz-functions-test.patch | 43 ++++++ ...02-prevent-multiple-libc-definitions.patch | 39 ++++++ .../src/gettext/0002-wip-disable-msvc.patch | 131 ++++++++++++++++++ contrib/src/gettext/emscripten.patch | 35 +++++ contrib/src/gettext/rules.mak | 35 ++++- 6 files changed, 310 insertions(+), 2 deletions(-) create mode 100644 contrib/src/gettext/0001-wip-fix-argz-erroneous-test-result.patch create mode 100644 contrib/src/gettext/0001-wip-hack-to-fix-erroneous-argz-functions-test.patch create mode 100644 contrib/src/gettext/0002-prevent-multiple-libc-definitions.patch create mode 100644 contrib/src/gettext/0002-wip-disable-msvc.patch create mode 100644 contrib/src/gettext/emscripten.patch diff --git a/contrib/src/gettext/0001-wip-fix-argz-erroneous-test-result.patch b/contrib/src/gettext/0001-wip-fix-argz-erroneous-test-result.patch new file mode 100644 index 0000000000..dcc6c0958c --- /dev/null +++ b/contrib/src/gettext/0001-wip-fix-argz-erroneous-test-result.patch @@ -0,0 +1,29 @@ +From 9e9b1ecf5f705246af8fc05427503a0a4a0db852 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Tue, 7 Jul 2020 18:59:49 +0000 +Subject: [PATCH 1/1] wip: fix argz erroneous test result + +--- + gettext-runtime/m4/intl.m4 | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gettext-runtime/m4/intl.m4 b/gettext-runtime/m4/intl.m4 +index 42fac95..e8ba814 100644 +--- a/gettext-runtime/m4/intl.m4 ++++ b/gettext-runtime/m4/intl.m4 +@@ -227,10 +227,9 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE], + [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], + [Define to 1 if the compiler understands __builtin_expect.])]) + +- AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h]) ++ AC_CHECK_HEADERS([inttypes.h limits.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \ +- stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \ +- argz_stringify argz_next __fsetlocking]) ++ stpcpy strcasecmp strdup strtoul tsearch uselocale __fsetlocking]) + + dnl Solaris 12 provides getlocalename_l, while Illumos doesn't have + dnl it nor the equivalent. +-- +2.26.2 + diff --git a/contrib/src/gettext/0001-wip-hack-to-fix-erroneous-argz-functions-test.patch b/contrib/src/gettext/0001-wip-hack-to-fix-erroneous-argz-functions-test.patch new file mode 100644 index 0000000000..b1c1cba4ba --- /dev/null +++ b/contrib/src/gettext/0001-wip-hack-to-fix-erroneous-argz-functions-test.patch @@ -0,0 +1,43 @@ +From 1185d380eb3b741d92867c0dd7919c5ae6580220 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 8 Jul 2020 10:03:09 +0000 +Subject: [PATCH 1/2] wip: hack to fix erroneous argz functions test + +--- + gettext-runtime/intl/l10nflist.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gettext-runtime/intl/l10nflist.c b/gettext-runtime/intl/l10nflist.c +index 7e52b13..e3058bf 100644 +--- a/gettext-runtime/intl/l10nflist.c ++++ b/gettext-runtime/intl/l10nflist.c +@@ -80,7 +80,7 @@ static char *stpcpy (char *dest, const char *src); + + /* Define function which are usually not available. */ + +-#if defined HAVE_ARGZ_COUNT ++#if defined HAVE_ARGZ_COUNT && !defined (__EMSCRIPTEN__) + # undef __argz_count + # define __argz_count argz_count + #else +@@ -102,7 +102,7 @@ argz_count__ (const char *argz, size_t len) + # define __argz_count(argz, len) argz_count__ (argz, len) + #endif /* !_LIBC && !HAVE_ARGZ_COUNT */ + +-#if defined HAVE_ARGZ_STRINGIFY ++#if defined HAVE_ARGZ_STRINGIFY && !defined (__EMSCRIPTEN__) + # undef __argz_stringify + # define __argz_stringify argz_stringify + #else +@@ -125,7 +125,7 @@ argz_stringify__ (char *argz, size_t len, int sep) + #endif /* !_LIBC && !HAVE_ARGZ_STRINGIFY */ + + #ifdef _LIBC +-#elif defined HAVE_ARGZ_NEXT ++#elif defined HAVE_ARGZ_NEXT && !defined (__EMSCRIPTEN__) + # undef __argz_next + # define __argz_next argz_next + #else +-- +2.26.2 + diff --git a/contrib/src/gettext/0002-prevent-multiple-libc-definitions.patch b/contrib/src/gettext/0002-prevent-multiple-libc-definitions.patch new file mode 100644 index 0000000000..96008c1b15 --- /dev/null +++ b/contrib/src/gettext/0002-prevent-multiple-libc-definitions.patch @@ -0,0 +1,39 @@ +From d35a3ee9c7804f260b9dea7dbbc08daefc001fe6 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Mon, 6 Jul 2020 11:38:01 +0000 +Subject: [PATCH 2/2] prevent multiple libc definitions + +--- + gettext-tools/libgettextpo/Makefile.am | 2 +- + gettext-tools/src/Makefile.am | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gettext-tools/libgettextpo/Makefile.am b/gettext-tools/libgettextpo/Makefile.am +index 36bd700..9e38c59 100644 +--- a/gettext-tools/libgettextpo/Makefile.am ++++ b/gettext-tools/libgettextpo/Makefile.am +@@ -109,7 +109,7 @@ libgettextpo_la_LIBADD = libgnu.la $(WOE32_LIBADD) $(LTLIBUNISTRING) + libgettextpo_la_LDFLAGS = \ + -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ + -rpath $(libdir) \ +- @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined ++ @LTLIBINTL@ @LTLIBICONV@ -no-undefined + + # Tell the mingw or Cygwin linker which symbols to export. + if WOE32DLL +diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am +index 0538d1e..59a2f77 100644 +--- a/gettext-tools/src/Makefile.am ++++ b/gettext-tools/src/Makefile.am +@@ -253,7 +253,7 @@ cldr_plurals_LDADD = libgettextsrc.la $(LDADD) + # use iconv(). + libgettextsrc_la_LDFLAGS = \ + -release @VERSION@ \ +- ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined ++ ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ -no-undefined + + # OS/2 does not support a DLL name longer than 8 characters. + if OS2 +-- +2.26.2 + diff --git a/contrib/src/gettext/0002-wip-disable-msvc.patch b/contrib/src/gettext/0002-wip-disable-msvc.patch new file mode 100644 index 0000000000..9bf5e4017a --- /dev/null +++ b/contrib/src/gettext/0002-wip-disable-msvc.patch @@ -0,0 +1,131 @@ +From 881e590895a3143b2fe78226e420255746f32cbd Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 8 Jul 2020 10:50:36 +0000 +Subject: [PATCH 2/2] wip: disable msvc + +--- + gettext-runtime/gnulib-lib/msvc-inval.c | 4 +++- + gettext-runtime/gnulib-lib/msvc-nothrow.c | 4 +++- + gettext-tools/gnulib-lib/msvc-inval.c | 4 +++- + gettext-tools/gnulib-lib/msvc-nothrow.c | 4 +++- + gettext-tools/libgettextpo/msvc-inval.c | 4 +++- + gettext-tools/libgettextpo/msvc-nothrow.c | 4 +++- + 6 files changed, 18 insertions(+), 6 deletions(-) + +diff --git a/gettext-runtime/gnulib-lib/msvc-inval.c b/gettext-runtime/gnulib-lib/msvc-inval.c +index baaf39e..d4ea004 100644 +--- a/gettext-runtime/gnulib-lib/msvc-inval.c ++++ b/gettext-runtime/gnulib-lib/msvc-inval.c +@@ -15,7 +15,8 @@ + with this program; if not, see . */ + + #include +- ++#ifdef __EMSCRIPTEN__ ++#else + /* Specification. */ + #include "msvc-inval.h" + +@@ -127,3 +128,4 @@ gl_msvc_inval_ensure_handler (void) + } + + #endif ++#endif +diff --git a/gettext-runtime/gnulib-lib/msvc-nothrow.c b/gettext-runtime/gnulib-lib/msvc-nothrow.c +index ba75bbf..92c240c 100644 +--- a/gettext-runtime/gnulib-lib/msvc-nothrow.c ++++ b/gettext-runtime/gnulib-lib/msvc-nothrow.c +@@ -16,7 +16,8 @@ + with this program; if not, see . */ + + #include +- ++#ifdef __EMSCRIPTEN__ ++#else + /* Specification. */ + #include "msvc-nothrow.h" + +@@ -47,3 +48,4 @@ _gl_nothrow_get_osfhandle (int fd) + return result; + } + #endif ++#endif +diff --git a/gettext-tools/gnulib-lib/msvc-inval.c b/gettext-tools/gnulib-lib/msvc-inval.c +index baaf39e..d4ea004 100644 +--- a/gettext-tools/gnulib-lib/msvc-inval.c ++++ b/gettext-tools/gnulib-lib/msvc-inval.c +@@ -15,7 +15,8 @@ + with this program; if not, see . */ + + #include +- ++#ifdef __EMSCRIPTEN__ ++#else + /* Specification. */ + #include "msvc-inval.h" + +@@ -127,3 +128,4 @@ gl_msvc_inval_ensure_handler (void) + } + + #endif ++#endif +diff --git a/gettext-tools/gnulib-lib/msvc-nothrow.c b/gettext-tools/gnulib-lib/msvc-nothrow.c +index ba75bbf..92c240c 100644 +--- a/gettext-tools/gnulib-lib/msvc-nothrow.c ++++ b/gettext-tools/gnulib-lib/msvc-nothrow.c +@@ -16,7 +16,8 @@ + with this program; if not, see . */ + + #include +- ++#ifdef __EMSCRIPTEN__ ++#else + /* Specification. */ + #include "msvc-nothrow.h" + +@@ -47,3 +48,4 @@ _gl_nothrow_get_osfhandle (int fd) + return result; + } + #endif ++#endif +diff --git a/gettext-tools/libgettextpo/msvc-inval.c b/gettext-tools/libgettextpo/msvc-inval.c +index baaf39e..d4ea004 100644 +--- a/gettext-tools/libgettextpo/msvc-inval.c ++++ b/gettext-tools/libgettextpo/msvc-inval.c +@@ -15,7 +15,8 @@ + with this program; if not, see . */ + + #include +- ++#ifdef __EMSCRIPTEN__ ++#else + /* Specification. */ + #include "msvc-inval.h" + +@@ -127,3 +128,4 @@ gl_msvc_inval_ensure_handler (void) + } + + #endif ++#endif +diff --git a/gettext-tools/libgettextpo/msvc-nothrow.c b/gettext-tools/libgettextpo/msvc-nothrow.c +index ba75bbf..92c240c 100644 +--- a/gettext-tools/libgettextpo/msvc-nothrow.c ++++ b/gettext-tools/libgettextpo/msvc-nothrow.c +@@ -16,7 +16,8 @@ + with this program; if not, see . */ + + #include +- ++#ifdef __EMSCRIPTEN__ ++#else + /* Specification. */ + #include "msvc-nothrow.h" + +@@ -47,3 +48,4 @@ _gl_nothrow_get_osfhandle (int fd) + return result; + } + #endif ++#endif +-- +2.26.2 + diff --git a/contrib/src/gettext/emscripten.patch b/contrib/src/gettext/emscripten.patch new file mode 100644 index 0000000000..f1492b5b0a --- /dev/null +++ b/contrib/src/gettext/emscripten.patch @@ -0,0 +1,35 @@ +From 3e9c76fd26eb9343128440300a2bfa1dcbd65df0 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Mon, 6 Jul 2020 11:31:37 +0000 +Subject: [PATCH 1/2] add emscripten support + +--- + build-aux/config.sub | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/build-aux/config.sub b/build-aux/config.sub +index 6d86a1e..795e2aa 100755 +--- a/build-aux/config.sub ++++ b/build-aux/config.sub +@@ -2,7 +2,7 @@ + # Configuration validation subroutine script. + # Copyright 1992-2016 Free Software Foundation, Inc. + +-timestamp='2016-05-10' ++timestamp='2020-07-06' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -1531,6 +1531,9 @@ case $os in + ;; + -nacl*) + ;; ++ -emscripten) ++ os=-emscripten ++ ;; + -ios) + ;; + -none) +-- +2.26.2 + diff --git a/contrib/src/gettext/rules.mak b/contrib/src/gettext/rules.mak index aa2ffc2244..533cd27d5c 100644 --- a/contrib/src/gettext/rules.mak +++ b/contrib/src/gettext/rules.mak @@ -18,6 +18,14 @@ $(TARBALLS)/gettext-$(GETTEXT_VERSION).tar.gz: gettext: gettext-$(GETTEXT_VERSION).tar.gz .sum-gettext $(UNPACK) $(APPLY) $(SRC)/gettext/0001-libasprintf-On-mingw-really-use-our-vasprintf-functi.patch + +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/gettext/emscripten.patch + $(APPLY) $(SRC)/gettext/0002-prevent-multiple-libc-definitions.patch + $(APPLY) $(SRC)/gettext/0001-wip-fix-argz-erroneous-test-result.patch + $(APPLY) $(SRC)/gettext/0001-wip-hack-to-fix-erroneous-argz-functions-test.patch + $(APPLY) $(SRC)/gettext/0002-wip-disable-msvc.patch +endif $(APPLY) $(SRC)/gettext/0002-libasprintf-Avoid-compilation-error-on-mingw-with-D_.patch $(MOVE) @@ -35,15 +43,38 @@ GETTEXT_CONF += --disable-threads GETTEXT_CFLAGS += -DLIBXML_STATIC endif +ifdef HAVE_EMSCRIPTEN +# msg-fmt* expects these functions to be exported +# we will need to add them to the runtime: +# posix_spawn_file_actions_addclose +# posix_spawn_file_actions_adddup2 +# posix_spawn_file_actions_addopen +# posix_spawn_file_actions_destroy +# posix_spawn_file_actions_init +# posix_spawnattr_destroy +# posix_spawnattr_init +# posix_spawnattr_setflags +# posix_spawnattr_setsigmask +GETTEXT_CFLAGS := $(CFLAGS) -s ERROR_ON_UNDEFINED_SYMBOLS=0 +GETTEXT_CONF += --disable-threads +endif + .gettext: gettext cd $< && $(HOSTVARS) ./configure $(HOSTCONF) CFLAGS="$(GETTEXT_CFLAGS)" $(GETTEXT_CONF) -ifndef HAVE_ANDROID - cd $< && $(MAKE) install +ifdef HAVE_EMSCRIPTEN + cd $< && $(MAKE) -C gettext-runtime install + cd $< && $(MAKE) -C gettext-tools/intl + cd $< && $(MAKE) -C gettext-tools/misc install + cd $< && $(MAKE) -C gettext-tools/m4 install else +ifdef HAVE_ANDROID cd $< && $(MAKE) -C gettext-runtime install cd $< && $(MAKE) -C gettext-tools/intl cd $< && $(MAKE) -C gettext-tools/misc install cd $< && $(MAKE) -C gettext-tools/m4 install +else + cd $< && $(MAKE) install +endif endif ifdef HAVE_MACOSX # detect libintl correctly in configure for static library -- GitLab From ff830b16c1a6e309379229d70e1390fb260578d3 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat Date: Wed, 8 Jul 2020 20:39:53 +0000 Subject: [PATCH 17/17] wip: fix gcrypt and gpg-error dependency ignore ntohs undefined symbol --- ...st-stricmp-that-returns-wrong-result.patch | 25 ++++++++ ...rtime-test-that-erroneously-succeeds.patch | 25 ++++++++ contrib/src/gcrypt/rules.mak | 8 +++ .../0001-add-emscripten-support.patch | 49 +++++++++++++++ .../0002-fix-gpg_err_init-prototype.patch | 59 +++++++++++++++++++ contrib/src/gpg-error/rules.mak | 4 ++ 6 files changed, 170 insertions(+) create mode 100644 contrib/src/gcrypt/0001-disable-test-stricmp-that-returns-wrong-result.patch create mode 100644 contrib/src/gcrypt/0002-remove-gethrtime-test-that-erroneously-succeeds.patch create mode 100644 contrib/src/gpg-error/0001-add-emscripten-support.patch create mode 100644 contrib/src/gpg-error/0002-fix-gpg_err_init-prototype.patch diff --git a/contrib/src/gcrypt/0001-disable-test-stricmp-that-returns-wrong-result.patch b/contrib/src/gcrypt/0001-disable-test-stricmp-that-returns-wrong-result.patch new file mode 100644 index 0000000000..75d96bb2f5 --- /dev/null +++ b/contrib/src/gcrypt/0001-disable-test-stricmp-that-returns-wrong-result.patch @@ -0,0 +1,25 @@ +From 3523ce69c47e52f9dcd59244a1522bb944513eed Mon Sep 17 00:00:00 2001 +From: Cony Cone +Date: Wed, 8 Jul 2020 21:44:47 +0000 +Subject: [PATCH 1/2] disable test stricmp that returns wrong result + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 1667eab..f6f87e7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1685,7 +1685,7 @@ AC_FUNC_VPRINTF + # We have replacements for these in src/missing-string.c + AC_CHECK_FUNCS(stpcpy strcasecmp) + # We have replacements for these in src/g10lib.h +-AC_CHECK_FUNCS(strtoul memmove stricmp atexit raise) ++AC_CHECK_FUNCS(strtoul memmove atexit raise) + # Other checks + AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4) + AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog) +-- +2.26.2 + diff --git a/contrib/src/gcrypt/0002-remove-gethrtime-test-that-erroneously-succeeds.patch b/contrib/src/gcrypt/0002-remove-gethrtime-test-that-erroneously-succeeds.patch new file mode 100644 index 0000000000..157a0e51f2 --- /dev/null +++ b/contrib/src/gcrypt/0002-remove-gethrtime-test-that-erroneously-succeeds.patch @@ -0,0 +1,25 @@ +From cbd52a4b71f5a1c89745a65f621c764893cedc50 Mon Sep 17 00:00:00 2001 +From: Cony Cone +Date: Wed, 8 Jul 2020 21:53:53 +0000 +Subject: [PATCH 2/2] remove gethrtime test that erroneously succeeds + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index f6f87e7..f1d936e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1688,7 +1688,7 @@ AC_CHECK_FUNCS(stpcpy strcasecmp) + AC_CHECK_FUNCS(strtoul memmove atexit raise) + # Other checks + AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4) +-AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog) ++AC_CHECK_FUNCS(gettimeofday getrusage clock_gettime syslog) + AC_CHECK_FUNCS(syscall fcntl ftruncate flockfile) + + GNUPG_CHECK_MLOCK +-- +2.26.2 + diff --git a/contrib/src/gcrypt/rules.mak b/contrib/src/gcrypt/rules.mak index 625ff30d71..4c5287a953 100644 --- a/contrib/src/gcrypt/rules.mak +++ b/contrib/src/gcrypt/rules.mak @@ -19,6 +19,10 @@ gcrypt: libgcrypt-$(GCRYPT_VERSION).tar.bz2 .sum-gcrypt $(APPLY) $(SRC)/gcrypt/0001-random-Don-t-assume-that-_WIN64-implies-x86_64.patch $(APPLY) $(SRC)/gcrypt/0002-aarch64-mpi-Fix-building-the-mpi-aarch64-assembly-fo.patch $(APPLY) $(SRC)/gcrypt/0001-compat-provide-a-getpid-replacement-that-works-on-Wi.patch +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/gcrypt/0001-disable-test-stricmp-that-returns-wrong-result.patch + $(APPLY) $(SRC)/gcrypt/0002-remove-gethrtime-test-that-erroneously-succeeds.patch +endif ifdef HAVE_WINSTORE $(APPLY) $(SRC)/gcrypt/winrt.patch endif @@ -50,8 +54,12 @@ endif ifdef HAVE_IOS GCRYPT_EXTRA_CFLAGS = -fheinous-gnu-extensions else +ifdef HAVE_EMSCRIPTEN +GCRYPT_EXTRA_CFLAGS = -s ERROR_ON_UNDEFINED_SYMBOLS=0 +else GCRYPT_EXTRA_CFLAGS = endif +endif ifdef HAVE_MACOSX GCRYPT_CONF += --disable-aesni-support else diff --git a/contrib/src/gpg-error/0001-add-emscripten-support.patch b/contrib/src/gpg-error/0001-add-emscripten-support.patch new file mode 100644 index 0000000000..699d64ed29 --- /dev/null +++ b/contrib/src/gpg-error/0001-add-emscripten-support.patch @@ -0,0 +1,49 @@ +From b9d87b5db65b5162886bf7231b5da359b9631d84 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 8 Jul 2020 20:54:34 +0000 +Subject: [PATCH 1/2] add emscripten support + +--- + build-aux/config.sub | 5 ++++- + src/mkheader.c | 2 +- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/build-aux/config.sub b/build-aux/config.sub +index 9feb73b..0bf8477 100755 +--- a/build-aux/config.sub ++++ b/build-aux/config.sub +@@ -2,7 +2,7 @@ + # Configuration validation subroutine script. + # Copyright 1992-2016 Free Software Foundation, Inc. + +-timestamp='2016-06-20' ++timestamp='2020-07-08' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -1541,6 +1541,9 @@ case $os in + ;; + -ios) + ;; ++ -emscripten) ++ os=-emscripten ++ ;; + -none) + ;; + *) +diff --git a/src/mkheader.c b/src/mkheader.c +index 121d029..e2c1ef3 100644 +--- a/src/mkheader.c ++++ b/src/mkheader.c +@@ -90,7 +90,7 @@ canon_host_triplet (const char *triplet) + {"armv7-unknown-linux-gnueabihf" }, + {"armv5-unknown-linux-musleabi" }, + {"armv6-unknown-linux-musleabihf" }, +- ++ {"wasm32-unknown-emscripten"}, + {"armv7-apple-darwin", "arm-apple-darwin"}, + + { NULL } +-- +2.26.2 + diff --git a/contrib/src/gpg-error/0002-fix-gpg_err_init-prototype.patch b/contrib/src/gpg-error/0002-fix-gpg_err_init-prototype.patch new file mode 100644 index 0000000000..d920a5c69f --- /dev/null +++ b/contrib/src/gpg-error/0002-fix-gpg_err_init-prototype.patch @@ -0,0 +1,59 @@ +From 2023f931a73fb8905b5ba9f7fb6145acb195e0b2 Mon Sep 17 00:00:00 2001 +From: Mehdi Sabwat +Date: Wed, 8 Jul 2020 20:58:59 +0000 +Subject: [PATCH 2/2] fix gpg_err_init prototype + +wasm-ld does not ignore the return type as expected on +native platforms, when we add the __attribute__((constructor)) +--- + src/gpg-error.h.in | 2 +- + src/visibility.c | 4 ++-- + src/visibility.h | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in +index 988898e..c5d8b10 100644 +--- a/src/gpg-error.h.in ++++ b/src/gpg-error.h.in +@@ -286,7 +286,7 @@ gpgrt_annotate_leaked_object (const void *p) + /* Initialization function. */ + + /* Initialize the library. This function should be run early. */ +-gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR; ++void gpg_err_init (void) _GPG_ERR_CONSTRUCTOR; + + /* If this is defined, the library is already initialized by the + constructor and does not need to be initialized explicitely. */ +diff --git a/src/visibility.c b/src/visibility.c +index b637e7a..771f1c8 100644 +--- a/src/visibility.c ++++ b/src/visibility.c +@@ -66,10 +66,10 @@ gpg_err_set_errno (int err) + } + + +-gpg_error_t ++void + gpg_err_init (void) + { +- return _gpg_err_init (); ++ + } + + void +diff --git a/src/visibility.h b/src/visibility.h +index da8e228..d40b881 100644 +--- a/src/visibility.h ++++ b/src/visibility.h +@@ -51,7 +51,7 @@ MARK_VISIBLE (gpg_err_code_to_errno) + MARK_VISIBLE (gpg_err_code_from_syserror) + MARK_VISIBLE (gpg_err_set_errno) + +-MARK_VISIBLE (gpg_err_init) ++extern void gpg_err_init (void) __attribute__ ((visibility("default"))); + MARK_VISIBLE (gpg_err_deinit) + MARK_VISIBLE (gpg_error_check_version) + MARK_VISIBLE (gpgrt_check_version) +-- +2.26.2 + diff --git a/contrib/src/gpg-error/rules.mak b/contrib/src/gpg-error/rules.mak index a22c778632..5cdff557bd 100644 --- a/contrib/src/gpg-error/rules.mak +++ b/contrib/src/gpg-error/rules.mak @@ -25,6 +25,10 @@ endif $(APPLY) $(SRC)/gpg-error/version-bump-gawk-5.patch $(APPLY) $(SRC)/gpg-error/win32-extern-struct.patch $(APPLY) $(SRC)/gpg-error/darwin-triplet.patch +ifdef HAVE_EMSCRIPTEN + $(APPLY) $(SRC)/gpg-error/0001-add-emscripten-support.patch + $(APPLY) $(SRC)/gpg-error/0002-fix-gpg_err_init-prototype.patch +endif $(MOVE) ifdef HAVE_ANDROID ifeq ($(ARCH),aarch64) -- GitLab