New autospec template ocaml-libs for OCaml libraries.

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2013-07-19 21:33:20 +02:00
parent b4e680004a
commit 5e8e99ecdc
7 changed files with 189 additions and 23 deletions

View File

@ -1,4 +1,4 @@
Changes in version 1.16.4
Changes in version 1.16.4
Sat Jul 13 2013 Madrisan <davide.madrisan(a)gmail.com>
+ bugfix
@ -17,6 +17,24 @@ Sat Jul 13 2013 Madrisan <davide.madrisan(a)gmail.com>
* conf/02-specfile-rpm-groups.conf - Davide Madrisan:
Add specific rpm groups for OCaml libraries and development packages.
+ improvement
* templates/ocaml-libs, templates/Makefile - Davide Madrisan:
New autospec template for OCaml libraries.
* plugins/spec-create - Davide Madrisan:
Add support for the new template ocaml-libs.
* conf/02-specfile-rpm-macros-ocaml.conf - Davide Madrisan:
New configuration file for the OCaml (library) modules.
+ update
* po/it/pck-update.po - Davide Madrisan:
Update the italian translation strings.
* italian manpage - Davide Madrisan:
Document the new template ocaml-libs.
-------------------------------------------------------------------------------
Changes in version 1.16.3

View File

@ -0,0 +1,5 @@
## Macros for OCaml packages --------------------------------------------------
# Force a name structure for OCaml packages
# Set to "" if you don't want to fix a structure
ocaml_module_name_structure="^ocaml-"

View File

@ -24,7 +24,7 @@
\fBlibtest.lib\fR - libreria con le funzioni del framework di test.
.SH VERSIONE
Questo documento e' aggiornato alla versione 1.16.3 di
Questo documento e' aggiornato alla versione 1.16.4 di
.B @package@.
.SH DESCRIZIONE
@ -204,6 +204,8 @@ categoria dello specfile da generare:
.br
\fIlibrary\fR : specfile per librerie
.br
\fIocaml-libs\fR : specfile per librerie OCaml
.br
\fIperl\fR : specfile per singoli moduli perl
.br
\fIpython\fR : specfile per moduli python

View File

@ -82,7 +82,7 @@ or FITNESS FOR A PARTICULAR PURPOSE."
function version() {
echo "\
${me[0]} ${me[1]}
Copyright (C) 2004-2012 Davide Madrisan <davide.madrisan@gmail.com>"
Copyright (C) 2004-2013 Davide Madrisan <davide.madrisan@gmail.com>"
}
# $1: optional exit code (default is '1')
@ -106,6 +106,7 @@ function usage() {
kde3 : "$"specfile for kde3 packages""
kde4 : "$"specfile for kde4 packages""
library : "$"specfile for common library packages""
ocaml-libs : "$"specfile for OCaml library packages""
perl : "$"specfile for single-package perl modules""
python : "$"specfile for python modules""
standard-daemon : "$"standard specfile for system/network services""
@ -404,6 +405,10 @@ $FUNCNAME: buildrequires_buildtool = \"$buildrequires_buildtool\""
[ -r "$templatefile" ] || notify.error $"file not found"": $templatefile"
local pck_name_tail="<FIXME>"
case "$pck_name" in *-*) pck_name_tail="${pck_name#*-}" ;; esac
notify.debug "$FUNCNAME: pck_name_tail = \"$pck_name_tail\""
local currvar line if_value if_level=0
# FIXME: at most two nested @if statements are supported
if_value[0]='N/A'; if_value[1]='1'; if_value[2]='1';
@ -454,6 +459,7 @@ s,@packager_fullname@,${packager_fullname:-?packager_fullname?},
s,@packager_email@,${packager_email:-?packager_email?},
s,@rpm_default_buildroot@,${rpm_default_buildroot:-?rpm_default_buildroot?},
s,@pck_name@,$pck_name,
s,@pck_name_tail@,$pck_name_tail,
s,@pck_version@,$pck_version,
s,@spec_first_release@,${spec_first_release:-1},
s,@spec_run_ldconfig@,$spec_run_ldconfig,
@ -591,6 +597,11 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \
[[ "$pck_name" =~ $library_name_structure ]] || notify.error $"\
libraries must have this name structure (use \`-n'):"" \
\`$library_name_structure'"
;;
ocaml-libs)
[[ "$pck_name" =~ $ocaml_module_name_structure ]] || notify.error $"\
ocaml modules must have this name structure (use \`-n'):"" \
\`$ocaml_module_name_structure'"
;;
perl)
[[ "$pck_name" =~ $perl_module_name_structure ]] || notify.error $"\
@ -701,7 +712,8 @@ looks like a python module (use \`-t python' if this is true)" ;;
# 2. set 'spec_summary'
local spec_summary="$spec_default_summary"
local perl_pckname_from_makefile=""
case "$spec_type" in perl)
case "$spec_type" in
perl)
if [ -e $tmpdir/$pck_rootdir/Makefile.PL ]; then
# look for the variable `NAME' in Makefile.PL inside the
# 'WriteMakefile(' ... ')' block
@ -717,6 +729,26 @@ looks like a python module (use \`-t python' if this is true)" ;;
fi
[ -n "$perl_pckname_from_makefile" ] &&
spec_summary="$perl_pckname_from_makefile - ..."
;;
ocaml-libs)
local metafile
metafile=$(find $tmpdir/$pck_rootdir/ -type f -name "META" 2>/dev/null)
[ "$metafile" ] || metafile="$(\
find $tmpdir/$pck_rootdir/ -type f -name "META.in" 2>/dev/null)"
if [ "$metafile" ]; then
#notify.debug "$FUNCNAME: OCaml META file found"
while read line; do
if [[ "$line" =~ ^description[\ \t]*=[\ \t]*\".*\"$ ]]; then
spec_summary="... $(\
echo "$line" | sed "s|.*=[\ \t]*\"\(.*\)\"|\1|") ..." # vim highlight need a "
notify.debug "$FUNCNAME: spec_summary = \"$spec_summary\""
break
fi
#if [[ "$line" =~ ^description[\ \t]*=[\ \t]*$ ]]; then
# ... FIXME
done < $metafile
fi
;;
esac
# 3. set 'spec_license'

View File

@ -1,3 +1,21 @@
# Italian translation.
# Copyright (C) 2004-2013 Davide Madrisan
# This file is distributed under the same license as the autospec package.
# Davide Madrisan <davide.madrisan@gmail.com>, 2004-2013.
#
msgid ""
msgstr "Project-Id-Version: autospec 1.16.4\n"
"Report-Msgid-Bugs-To: davide.madrisan@gmail.com\n"
"POT-Creation-Date: 2013-07-13 19:30+0100\n"
"PO-Revision-Date: 2013-07-13 19:30+0100\n"
"Last-Translator: Davide Madrisan <davide.madrisan@gmail.com>\n"
"Language-Team: \n"
"Language: Italian \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "this script requires bash version 2 or better"
msgstr "questo script richiede bash versione 2 o superiore"
@ -817,6 +835,9 @@ msgstr "specfile per pacchetti kde4"
msgid "specfile for common library packages"
msgstr "specfile per librerie"
msgid "specfile for OCaml library packages"
msgstr "specfile per pacchetti librerie OCaml"
msgid "specfile for single-package perl modules"
msgstr "specfile per singoli moduli perl"
@ -886,6 +907,9 @@ msgstr "modo"
msgid "libraries must have this name structure (use \\`-n'):"
msgstr "i nomi delle librerie devono avere questa struttura (usare \\`-n'):"
msgid "ocaml modules must have this name structure (use \\`-n'):"
msgstr "i nomi dei moduli ocaml devono avere questa struttura (usare \\`-n'):"
msgid "perl modules must have this name structure (use \\`-n'):"
msgstr "i nomi dei moduli perl devono avere questa struttura (usare \\`-n'):"
@ -923,23 +947,6 @@ msgstr "manca almeno una direttiva \\`%defattr'"
msgid "use rpm macros if possible:"
msgstr "utilizzare le macro rpm quando possibile:"
# Italian translation.
# Copyright (C) 2004-2012 Davide Madrisan
# This file is distributed under the same license as the autospec package.
# Davide Madrisan <davide.madrisan@gmail.com>, 2004-2012.
#
msgid ""
msgstr "Project-Id-Version: autospec 1.16.0\n"
"Report-Msgid-Bugs-To: davide.madrisan@gmail.com\n"
"POT-Creation-Date: 2012-11-23 22:50+0100\n"
"PO-Revision-Date: 2012-11-19 23:37+0100\n"
"Last-Translator: Davide Madrisan <davide.madrisan@gmail.com>\n"
"Language-Team: \n"
"Language: Italian \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "localization files must be packaged via \\`%find_lang'"
msgstr "trovati file di localizzazione non gestiti da \\`%find_lang'"

View File

@ -1,5 +1,5 @@
# Makefile for autospec
# Copyright (C) 2008,2011 by Davide Madrisan <davide.madrisan@gmail.com>
# Copyright (C) 2008,2011,2013 by Davide Madrisan <davide.madrisan@gmail.com>
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
@ -18,7 +18,7 @@ srcdir = ..
include $(srcdir)/Makefile.env
pck_templates := gnome kde3 kde4 library perl python standard standard-daemon web
pck_templates := gnome kde3 kde4 library ocaml-libs perl python standard standard-daemon web
all:

102
templates/ocaml-libs Normal file
View File

@ -0,0 +1,102 @@
## this macro only works for packages with name matching the regexp "ocaml-.*"
%define ocamlpck @pck_name_tail@
Name: @pck_name@
Version: @pck_version@
Release: @spec_first_release@@DISTRO_rpm@
Summary: ...
Group: System/Libraries/OCaml
Vendor: @VENDOR@
Distribution: @DISTRO@
Packager: @packager_fullname@ <@packager_email@>
URL: ...
Source: ...
License: ...
## AUTOBUILDREQ-BEGIN
## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements.
## AUTOBUILDREQ-END
BuildRequires: ocaml
BuildRequires: ocaml-camlp4-devel
BuildRequires: ocaml-findlib
## remove the following build requirement if this package is compiled
## by using the OCaml native-code compiler (ocamlopt)
Requires: ocaml-runtime
BuildRoot: @rpm_default_buildroot@
%description
...
@if:pck_devel
## remove the following two blocks if there's no devel files
%package devel
Group: Development/Libraries/OCaml
Summary: Development files for %{name}
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description devel
This package contains libraries and signature files for developing applications that use %{name}.
@fi:pck_devel
%prep
%setup -q
%build
## remove the unsupported options (no real standard exists...)
./configure \\
\ --prefix %{_prefix} \\
\ --localstatedir %{_localstatedir} \\
\ --sharedstatedir %{_sharedstatedir} \\
\ --sysconfdir %{_sysconfdir} \\
\ --enable-tests \\
\ --enable-docs \\
\ --enable-examples \\
\ --disable-ldconf
## extra arguments that sometimes can be passed to './configure'
## -host %{_host}
## -cc "gcc ${RPM_OPT_FLAGS/-fomit-frame-pointer/}"
## --destdir %{buildroot}
%make all
%make opt
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
export OCAMLFIND_DESTDIR=%{buildroot}$(ocamlfind printconf destdir)
export DLLDIR=$OCAMLFIND_DESTDIR/stublibs
install -d $OCAMLFIND_DESTDIR/%{ocamlpck}
install -d $OCAMLFIND_DESTDIR/stublibs
make install
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
## note: this list is just an example; modify as required
# %dir %{_libdir}/ocaml/%{ocamlpck}
# %{_libdir}/ocaml/%{ocamlpck}/META
# %{_libdir}/ocaml/%{ocamlpck}/*.cma
# %{_libdir}/ocaml/%{ocamlpck}/*.cmi
# %{_libdir}/ocaml/%{ocamlpck}/*.cmxs
# %{_libdir}/ocaml/stublibs/*.so*
# %doc COPYING
@if:pck_devel
## remove this block if there are no devel files
## note: this list is just an example; modify as required
%files devel
%defattr(-,root,root)
# %{_libdir}/ocaml/%{ocamlpck}/*.a
# %{_libdir}/ocaml/%{ocamlpck}/*.cmx
# %{_libdir}/ocaml/%{ocamlpck}/*.cmxa
# %{_libdir}/ocaml/%{ocamlpck}/*.mli
# %doc CHANGES README
# %doc doc/html/
# %doc examples/
@fi:pck_devel
%changelog
* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@
- @spec_changelog_comment@