Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
123 lines (105 sloc) 4.32 KB
# handy macros for erlang-related packages
%_erldir %{_libdir}/erlang
%_erllibdir %{_erldir}/lib
%__rebar /usr/bin/rebar
%rebar_compile \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
VSN="%{version}" ; export VSN ; \
REBAR_VSN_CACHE_FILE="%{_builddir}/%{buildsubdir}/vsn.cache" ; export REBAR_VSN_CACHE_FILE ; \
echo "{{git, \\\"%{_builddir}/%{buildsubdir}\\\"}, \\\"%{version}\\\"}." > %{_builddir}/%{buildsubdir}/vsn.cache ; \
REBAR_DEPS_PREFER_LIBS="TRUE" ; export REBAR_DEPS_PREFER_LIBS ; \
IGNORE_MISSING_DEPS="TRUE" ; export IGNORE_MISSING_DEPS ; \
%__rebar compile skip_deps=true -vv \
%{nil}
# deprecated backwards compatibility
%__rebar_compile %rebar_compile
%rebar_ct(C:) \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
VSN="%{version}" ; export VSN ; \
REBAR_VSN_CACHE_FILE="%{_builddir}/%{buildsubdir}/vsn.cache" ; export REBAR_VSN_CACHE_FILE ; \
REBAR_DEPS_PREFER_LIBS="TRUE" ; export REBAR_DEPS_PREFER_LIBS ; \
%__rebar ct skip_deps=true -vv %{-C:-C %{-C*}} \
%{nil}
%rebar_doc \
if [ -f doc/overview.edoc ] ; then \
%__rebar doc -vv \
else \
echo "No 'doc/overview.edoc' file was found, so docs aren't generated." \
fi \
%{nil}
%rebar_eunit(C:) \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
VSN="%{version}" ; export VSN ; \
REBAR_VSN_CACHE_FILE="%{_builddir}/%{buildsubdir}/vsn.cache" ; export REBAR_VSN_CACHE_FILE ; \
REBAR_DEPS_PREFER_LIBS="TRUE" ; export REBAR_DEPS_PREFER_LIBS ; \
%__rebar eunit skip_deps=true -vv %{-C:-C %{-C*}} \
%{nil}
#
# More generic macros
#
# Define any of these but not all at the same time
%__erlappname %{?realname}%{?srcname}%{?erlappname}
#%__erlappname %(eval \
# if [ "%{?realname}" != "" ] ; then \
# echo -n "%{realname}"
# elif [ "%{?srcname}" != "" ] ; then \
# echo -n "%{srcname}" \
# else \
# echo -n "%{erlappname}" \
# fi \
#)
#
%erlang_ensure_app_src \
if [ ! -f src/%{__erlappname}.app.src -a ! -f src/%{__erlappname}.app -a ! -f ebin/%{__erlappname}.app ] ; then \
echo "{application, %{__erlappname}, [{description, \\\"%{summary}\\\"}, {vsn, \\\"%{version}\\\"}, {modules, []}]}." > src/%{__erlappname}.app.src \
else \
echo "*.app file (or *.app.src template) was found." \
fi \
%{nil}
%erlang_compile \
%erlang_ensure_app_src \
%rebar_compile \
%rebar_doc
%erlang_test(C:) \
%rebar_eunit %{-C:-C %{-C*}} \
%rebar_ct %{-C:-C %{-C*}}
%erlang_install \
if [ "%{__erlappname}" != "" ] ; then \
%{__mkdir} -p %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ \
%{__mkdir} -p %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \
if [ -f ebin/%{__erlappname}.app ] ; then \
%{__install} -m 0644 -p ebin/%{__erlappname}.app %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \
fi \
%{__install} -m 0644 -p ebin/*.beam %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \
if [ -d include/ ] ; then \
for erlincludefile in `ls include/*.hrl` ; do \
%{__install} -D -m 0644 -p $erlincludefile %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/$erlincludefile \
done \
fi \
if [ -d priv/ ] ; then \
for solibfile in `ls priv/*.so` ; do \
%{__install} -D -m 0755 -p $solibfile %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/$solibfile \
done \
fi \
fi \
%{nil}
%erlang_appdir %{_erllibdir}/%{__erlappname}-%{version}
%_erlang_appdir %erlang_appdir
%__erlang_nif_version %(eval \
rpm -q erlang-erts --provides | grep --color=no erl_nif_version \
)
%__erlang_drv_version %(eval \
rpm -q erlang-erts --provides | grep --color=no erl_drv_version \
)