File erlang.spec of Package erlang
%define langrel 25.0
%undefine patchlevel
%global debug_package %{nil}
%bcond_without systemd
Name: erlang
Version: %{langrel}%{?patchlevel}
Release: wiz%{?extraver:0.}1%{?dist}
Group: Development/Languages/Other
URL: http://www.erlang.org
License: Apache-2.0
Summary: Programming language designed at the Ericsson Computer Science Laboratory
# Systemd-specific requirements
%if %{with systemd}
Requires: systemd
BuildRequires: systemd-devel
%endif
%if 0%{?suse_version}
BuildRequires: fdupes chrpath
BuildRequires: libxml2-tools
%endif
BuildRequires: gcc-c++ perl m4 libxml2 libxslt
BuildRequires: ncurses-devel openssl-devel zlib-devel unixODBC-devel
BuildRequires: libatomic_ops-devel
BuildRequires: libgmp-devel
BuildRoot: %{_tmppath}/%{name}-root
Source: http://www.erlang.org/download/otp_src_%{langrel}%{?patchlevel}.tar.gz
%description
Erlang is a programming language designed at the Ericsson Computer Science
Laboratory. Open-source Erlang is being released to help encourage the spread
of Erlang outside Ericsson. We are releasing free of charge: The entire source
code of the current Erlang system. Extensive libraries of code for building
robust fault-tolerant distributed applications. All with documentation.
All the above software has been battle tested in a number of Ericsson products,
for example AXD301 (ATM switch).
%prep
%setup -q -n otp_src_%{langrel}%{?patchlevel}
%build
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
%configure \
--enable-dynamic-ssl-lib \
--enable-pie \
%if %{with systemd}
--enable-systemd \
%endif
--enable-jit \
--enable-pgo \
\
--with-odbc \
--with-gmp \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS -std=c++17" \
LDFLAGS="$_LDFLAGS"
%{__make} V=1 %{?_smp_mflags}
%{__make} V=1 %{?_smp_mflags} docs
%install
%{__make} install install-docs DESTDIR=%{buildroot}
# Remove script templates
find %{buildroot}%{_libdir}/erlang -name "*.src" -delete
# Remove static libraries
find %{buildroot}%{_libdir}/erlang -name "*.a" -delete
# Remove empty directories
find %{buildroot}%{_libdir}/erlang -type d -empty -delete
# On first run directory that contains only one empty directory itself is not empty
find %{buildroot}%{_libdir}/erlang -type d -empty -delete
%if 0%{?suse_version}
chrpath --delete %{buildroot}%{_libdir}/erlang/lib/crypto-*/priv/lib/crypto.so
chrpath --delete %{buildroot}%{_libdir}/erlang/lib/crypto-*/priv/lib/otp_test_engine.so
%fdupes %{buildroot}%{_libdir}
%endif
# Fix shebang
%{__sed} -ri '1 s|#!/usr/bin/env .*$|%{_bindir}/escript|' \
%{buildroot}%{_libdir}/erlang/lib/*/bin/* \
%{buildroot}%{_libdir}/erlang/lib/*/priv/bin/*.escript
%check
export ERL_TOP=`pwd -P`
%{__make} V=1 %{?_smp_mflags} release_tests
cd release/tests/test_server
$ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%license LICENSE.txt
%doc AUTHORS README.md
%{_bindir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*
%exclude %{_libdir}/%{name}/Install
%exclude %{_libdir}/%{name}/doc/tutorial
%exclude %{_libdir}/%{name}/usr/include
%exclude %{_libdir}/%{name}/usr
%exclude %{_libdir}/%{name}/lib/tools-*/emacs/test.erl.orig
%exclude %{_libdir}/%{name}/lib/*/src
%exclude %{_libdir}/%{name}/lib/*/c_src
%exclude %{_libdir}/%{name}/lib/*/examples
%exclude %{_libdir}/%{name}/lib/*/include/*.h
%exclude %{_libdir}/%{name}/erts-*/include
%exclude %{_libdir}/%{name}/erts-*/src
%changelog