erlang-lfe/erlang-lfe.spec
2020-08-29 18:01:59 +08:00

93 lines
3.3 KiB
RPMSpec

%global realname lfe
%global upstream rvirding
%global need_bootstrap 0
%if 0%{?need_bootstrap}
%global _erllibdir %{_libdir}/erlang/lib
%global debug_package %{nil}
%endif
Name: erlang-%{realname}
Version: 1.3
Release: 1
Summary: Lisp Flavoured Erlang
License: BSD
URL: https://github.com/%{upstream}/%{realname}
VCS: scm:git:https://github.com/%{upstream}/%{realname}.git
Source0: https://github.com/%{upstream}/%{realname}/archive/%{version}/%{realname}-%{version}.tar.gz
Patch1: erlang-lfe-0001-Remove-support-for-erlang-packages.patch
Patch2: erlang-lfe-0002-Convert-to-proper-UTF-8.patch
%if 0%{?need_bootstrap}
BuildRequires: erlang-erts erlang-rpm-macros
%else
BuildRequires: erlang-rebar
%endif
BuildRequires: pkgconfig emacs emacs-el gcc
Requires: emacs-filesystem
Obsoletes: emacs-erlang-lfe
Obsoletes: emacs-erlang-lfe-el
%{?__erlang_drv_version:Requires: %{__erlang_drv_version}}
%description
Lisp Flavoured Erlang, is a lisp syntax front-end to the Erlang
compiler. Code produced with it is compatible with "normal" Erlang
code. An LFE evaluator and shell is also included.
%prep
%setup -q -n %{realname}-%{version}
%patch1 -p1 -b .no_erl_packages
%patch2 -p1 -b .proper_utf8
%build
%if 0%{?need_bootstrap}
mkdir -p ./ebin/
/usr/bin/erlc -o ./ebin/ src/*.erl
%else
mkdir -p ./ebin/
%{erlang_compile}
%endif
emacs -L emacs/ -batch -f batch-byte-compile emacs/inferior-lfe.el emacs/lfe-mode.el emacs/lfe-indent.el
%install
install -m 0755 -d %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/{bin,ebin,priv}
install -p -m 0755 -D ebin/* %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/ebin/
install -p -m 0755 -D bin/* %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/bin/
%if 0%{?need_bootstrap}
echo "we are going to install only bare minimum of LFE - just for rebar bootstrapping"
%else
install -p -m 0755 priv/%{realname}_drv.so %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/priv/
%endif
install -m 0755 -d %{buildroot}/%{_bindir}
ln -s %{_libdir}/erlang/lib/%{realname}-%{version}/bin/{lfe,lfec,lfescript} %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_emacs_sitelispdir}
mkdir -p %{buildroot}%{_emacs_sitestartdir}
install -p -m 0644 emacs/inferior-lfe.el %{buildroot}%{_emacs_sitelispdir}
install -p -m 0644 emacs/inferior-lfe.elc %{buildroot}%{_emacs_sitelispdir}
install -p -m 0644 emacs/lfe-mode.el %{buildroot}%{_emacs_sitelispdir}
install -p -m 0644 emacs/lfe-mode.elc %{buildroot}%{_emacs_sitelispdir}
install -p -m 0644 emacs/lfe-indent.el %{buildroot}%{_emacs_sitelispdir}
install -p -m 0644 emacs/lfe-indent.elc %{buildroot}%{_emacs_sitelispdir}
install -p -m 0644 emacs/lfe-start.el %{buildroot}%{_emacs_sitestartdir}
%check
%if 0%{?need_bootstrap}
echo "No tests during bootstrapping"
%else
%endif
%files
%license LICENSE
%doc README.md doc/ examples/
%{_bindir}/lfe
%{_bindir}/lfec
%{_bindir}/lfescript
%{erlang_appdir}/
%{_emacs_sitelispdir}/inferior-lfe.el
%{_emacs_sitelispdir}/inferior-lfe.elc
%{_emacs_sitelispdir}/lfe-indent.el
%{_emacs_sitelispdir}/lfe-indent.elc
%{_emacs_sitelispdir}/lfe-mode.el
%{_emacs_sitelispdir}/lfe-mode.elc
%{_emacs_sitestartdir}/lfe-start.el
%changelog
* Sat Aug 29 2020 wangyue <wangyue92@huawei.com> - 1.3-1
- package init