Accepting request 866965 from devel:tools:compiler

Moving wasm toolchain to new javascript project

OBS-URL: https://build.opensuse.org/request/show/866965
OBS-URL: https://build.opensuse.org/package/show/devel:languages:javascript/binaryen?expand=0&rev=1
This commit is contained in:
2021-01-26 16:32:42 +00:00
committed by Git OBS Bridge
commit 1a9a4b2561
5 changed files with 166 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f805db6735869ab52cde7c0404879c90cf386888c0f587e944737550171c1c4
size 3680217

30
binaryen.changes Normal file
View File

@@ -0,0 +1,30 @@
-------------------------------------------------------------------
Tue Dec 1 06:17:51 UTC 2020 - Avindra Goolcharan <avindra@opensuse.org>
- update to v98
* Add --fast-math mode.
* Initial implementation of "Memory64" proposal
* Lots of changes in support of GC proposal
- ran spec-cleaner
- create .changes for first time
- fix build
-------------------------------------------------------------------
Wed Oct 7 05:22:51 UTC 2020 - Garret Wassermann <garret@wassiverse.com>
- updated to v97
* Remove asm2wasm, which supported Emscripten's fastcomp backend,
after fastcomp was removed.
* The new feature flag --enable-anyref enables just the anyref
type incl. basic subtyping of externref, funcref and exnref
(if enabled).
* Enabling the exception handling or anyref features without also
enabling reference types is a validation error now.
* The Host expression and its respective APIs have been refactored
into separate MemorySize and MemoryGrow expressions to align with
other memory instructions.
-------------------------------------------------------------------
Fri Dec 14 11:40:26 UTC 2018 - Garret Wassermann <garret@wassiverse.com>
- Initial package (v1.38.28)

109
binaryen.spec Normal file
View File

@@ -0,0 +1,109 @@
#
# spec file for package binaryen
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: binaryen
Version: 98
Release: 0
Summary: Compiler infrastructure and toolchain library for WebAssembly
License: Apache-2.0
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Development/Tools
URL: https://github.com/WebAssembly/binaryen
Source: %{name}-version_%{version}.tar.gz
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: python-devel
Requires: lib%{name} = %{version}
%description
Binaryen is a compiler and toolchain infrastructure library for WebAssembly, written in C++. It aims to make compiling to WebAssembly easy, fast, and effective:
* Easy: Binaryen has a simple C API in a single header. It accepts input in WebAssembly-like form but also accepts a general control flow graph for compilers that prefer that.
* Fast: Binaryen's internal IR uses compact data structures and is designed for completely parallel codegen and optimization, using all available CPU cores. Binaryen's IR also compiles down to WebAssembly extremely easily and quickly because it is essentially a subset of WebAssembly.
* Effective: Binaryen's optimizer has many passes that can improve code very significantly (e.g. local coloring to coalesce local variables; dead code elimination; precomputing expressions when possible at compile time; etc.). These optimizations aim to make Binaryen powerful enough to be used as a compiler backend by itself. One specific area of focus is on WebAssembly-specific optimizations (that general-purpose compilers might not do), which you can think of as wasm minification, similar to minification for JavaScript, CSS, etc., all of which are language-specific (an example of such an optimization is block return value generation in SimplifyLocals).
Compilers built using Binaryen include
* s2wasm which compiles the LLVM WebAssembly's backend .s output format
* mir2wasm which compiles Rust MIR
Those compilers generate Binaryen IR which can then be optimized and emitted as WebAssembly (the first two use the internal C++ API, the last the C API).
Binaryen also provides a set of toolchain utilities that can
* Parse and emit WebAssembly. In particular this lets you load WebAssembly, optimize it using Binaryen, and re-emit it, thus implementing a wasm-to-wasm optimizer.
* Interpret WebAssembly as well as run the WebAssembly spec tests.
* Integrate with Emscripten in order to provide a complete compiler toolchain from C and C++ to WebAssembly.
* Polyfill WebAssembly by running it in the interpreter compiled to JavaScript, if the browser does not yet have native support (useful for testing).
%package -n lib%{name}
Summary: Library for %{name}
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Development/Tools
%description -n lib%{name}
Library for %{name}.
%package -n lib%{name}-devel
Summary: Development files for lib%{name}
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Development/Tools
Requires: lib%{name} = %{version}
%description -n lib%{name}-devel
Development files for lib%{name}.
%prep
%autosetup -n %{name}-version_%{version}
# fix pthread link error
cat >> "./CMakeLists.txt" <<-EOF
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
EOF
%build
%cmake \
-DBUILD_TESTS=OFF \
-DENABLE_WERROR=OFF
%cmake_build
%install
%cmake_install
%post -n lib%{name} -p /sbin/ldconfig
%postun -n lib%{name} -p /sbin/ldconfig
%files
%license LICENSE
%doc README.md Contributing.md
%{_bindir}/wasm2js
%{_bindir}/wasm-as
%{_bindir}/wasm-ctor-eval
%{_bindir}/wasm-dis
%{_bindir}/wasm-emscripten-finalize
%{_bindir}/wasm-metadce
%{_bindir}/wasm-opt
%{_bindir}/wasm-reduce
%{_bindir}/wasm-shell
%files -n lib%{name}
%{_libdir}/lib%{name}.so
%files -n lib%{name}-devel
%{_includedir}/%{name}-c.h
%changelog