From Fedora Project Wiki
m (Starting to update this.)
(Added an example of spec-file)
Line 17: Line 17:
 
= Header files =
 
= Header files =
  
Header files for erlang modules must be bundled with main package (not in *-devel). They are very often used by system administrators right from the REPL console.
+
Header files for erlang modules stored in ./include directory must be bundled with main package (not in *-devel). They are very often used by system administrators right from the REPL console. Headers from ./src directory normally shouldn't be packaged.
 +
 
 +
= An example of spec-file =
 +
 
 +
<nowiki>%global realname foo
 +
%global upstream bar
 +
# Technically, we're noarch; but erlang whose directories we install into is not.
 +
# This should be removed if a package contains NIF, or driver.
 +
%global debug_package %{nil}
 +
 
 +
 
 +
Name: erlang-%{realname}
 +
Version: 1.2.3
 +
Release: 1%{?dist}
 +
Summary: Erlang library for doing cool things
 +
Group: Development/Libraries
 +
License: ASL 2.0
 +
URL: https://github.com/%{upstream}/%{realname}
 +
Source0: https://github.com/%{upstream}/%{realname}/archive/%{version}/%{realname}-%{version}.tar.gz
 +
BuildRequires: erlang-rebar
 +
 
 +
 
 +
%description
 +
Erlang library for doing cool things.
 +
 
 +
 
 +
%prep
 +
%setup -q -n %{realname}-%{version}
 +
 
 +
 
 +
%build
 +
%{erlang_compile}
 +
 
 +
 
 +
%install
 +
%{erlang_install}
 +
 
 +
# Additionally install some cool stuff required to run application properly
 +
cp -arv priv/ %{buildroot}%{erlang_appdir}/
 +
 
 +
 
 +
%check
 +
%{erlang_test}
 +
 
 +
 
 +
%files
 +
%license LICENSE.txt
 +
%doc doc/ examples/ README.md
 +
%{erlang_appdir}/
 +
 
 +
 
 +
* Wed Mar 16 2016 Peter Lemenkov <lemenkov@gmail.com> - 1.2.3-1
 +
- Initial build</nowiki>
  
 
[[Category:Packaging guidelines]]
 
[[Category:Packaging guidelines]]

Revision as of 16:31, 16 March 2016

THIS DOCUMENT IS WIP

This document seeks to document the conventions and customs surrounding the proper packaging of Erlang modules and applications in Fedora and EPEL. It does not intend to cover all situations, but to codify those practices which have served the Fedora Erlang community well.

Naming

erlang-%{realname}

File Locations

Erlang packages should install theirselves to %{_erllibdir}/%{realname}-%{version}. Big applications, such as Package-x-generic-16.pngejabberd, Package-x-generic-16.pngrabbitmq-server, Package-x-generic-16.pngriak install their content somewhere else due to historical reasons.

Debug symbols / source installation / dialyzer

Erlang package should not install its original sources. Instead packages should ensure that it's built with +debug_info flag. It does NOT impact the runtime performance of the application at all (beam loader disregards debug symbols before loading to VM). Dialyzer requires either this debug info or original sources.

Header files

Header files for erlang modules stored in ./include directory must be bundled with main package (not in *-devel). They are very often used by system administrators right from the REPL console. Headers from ./src directory normally shouldn't be packaged.

An example of spec-file

%global realname foo
%global upstream bar
# Technically, we're noarch; but erlang whose directories we install into is not.
# This should be removed if a package contains NIF, or driver.
%global debug_package %{nil}


Name:		erlang-%{realname}
Version:	1.2.3
Release:	1%{?dist}
Summary:	Erlang library for doing cool things
Group:		Development/Libraries
License:	ASL 2.0
URL:		https://github.com/%{upstream}/%{realname}
Source0:	https://github.com/%{upstream}/%{realname}/archive/%{version}/%{realname}-%{version}.tar.gz
BuildRequires:	erlang-rebar


%description
Erlang library for doing cool things.


%prep
%setup -q -n %{realname}-%{version}


%build
%{erlang_compile}


%install
%{erlang_install}

# Additionally install some cool stuff required to run application properly
cp -arv priv/ %{buildroot}%{erlang_appdir}/


%check
%{erlang_test}


%files
%license LICENSE.txt
%doc doc/ examples/ README.md
%{erlang_appdir}/


* Wed Mar 16 2016 Peter Lemenkov <lemenkov@gmail.com> - 1.2.3-1
- Initial build