File binaryen.spec of Package binaryen
#
# spec file for package binaryen
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
%define libver 1_38_28
Name: binaryen
Version: 1.38.28
Release: 0
Summary: Compiler infrastructure and toolchain library for WebAssembly
License: Apache-2.0
Group: Development/Tools/Building
URL: https://github.com/WebAssembly/binaryen
Source: https://github.com/WebAssembly/binaryen/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE binaryen-SONAME_version.patch
Patch0: binaryen-SONAME_version.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: python-devel
%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:
* asm2wasm which compiles asm.js
* 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}-%{libver}
Summary: Library for %{name}
Group: Development/Libraries/C and C++
%description -n lib%{name}-%{libver}
Library for %{name}.
%package -n lib%{name}-devel
Summary: Development files for lib%{name}
Group: Development/Languages/C and C++
Requires: lib%{name}-%{libver} = %{version}
%description -n lib%{name}-devel
Development files for lib%{name}.
%prep
%setup -q
%patch0 -p1
sed -i 's/__VERSION__/%{version}/g' CMakeLists.txt
%build
%cmake \
-DBUILD_TESTS=OFF
%make_jobs
%install
%cmake_install
%post -n lib%{name}-%{libver} -p /sbin/ldconfig
%postun -n lib%{name}-%{libver} -p /sbin/ldconfig
%files
%license LICENSE
%doc README.md Contributing.md
%{_bindir}/asm2wasm
%{_bindir}/wasm2js
%{_bindir}/wasm-as
%{_bindir}/wasm-ctor-eval
%{_bindir}/wasm-dis
%{_bindir}/wasm-emscripten-finalize
%{_bindir}/wasm-merge
%{_bindir}/wasm-metadce
%{_bindir}/wasm-opt
%{_bindir}/wasm-reduce
%{_bindir}/wasm-shell
%files -n lib%{name}-%{libver}
%{_libdir}/lib%{name}-%{version}.so
%files -n lib%{name}-devel
%{_includedir}/binaryen-c.h
%changelog