From 0f71f389e34735480af9aaa03464979f1c4a2fe9 Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Sun, 18 Dec 2011 15:24:59 +0100 Subject: [PATCH] spec-create, templates/library: support library packages with a name not starting by lib --- ChangeLog | 5 ++++ NEWS | 3 +- plugins/spec-create.in | 24 +++++++++++++-- templates/library | 68 ++++++++++++++++++++++++++++++++++++++---- 4 files changed, 90 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5a0a3a..142d74c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,11 @@ Changes in version 1.8.1 Devel package does not exist: move code for infopages installation/removal to the main package scriplets. ++ update + * spec-create, templates/library - Davide Madrisan: + Support library packages with a name not starting by 'lib'. + (Feature asked by Silvan Calarco) + -------------------------------------------------------------------------------- Changes in version 1.8.0 diff --git a/NEWS b/NEWS index d31d85c..3ec7095 100644 --- a/NEWS +++ b/NEWS @@ -16,7 +16,8 @@ List of user visible changes in the release 1.8.1 - Christmas Release Improve searching in sourceforge sites. * spec-create, templates - Davide Madrisan: - Several improvements and fixes. + Several improvements and fixes, notably for library packages with a name + not starting by 'lib'. ------------------------------------------------------------------------------- diff --git a/plugins/spec-create.in b/plugins/spec-create.in index af9d756..1b410dc 100644 --- a/plugins/spec-create.in +++ b/plugins/spec-create.in @@ -233,7 +233,7 @@ function template.expand() { source:,standard-docs:,standard-docs-devel:,build-technology:,\ i18n:,icons-mimetypes:,\ infopages:,manpages:,\ -pck-apidocs:,pck-tools:,\ +pck-devel:,pck-library:,pck-apidocs:,pck-tools:,\ shared-libraries:,\ -n "${0}" -- "$@"` [ $? = 0 ] || exit 1 @@ -243,6 +243,9 @@ shared-libraries:,\ local templatefile spec_type local pck_name pck_version + local pck_name_devel + local pck_name_tools + local pck_name_apidocs local spec_setup_macro local spec_summary="$spec_default_summary" local spec_license="$spec_default_license" @@ -254,6 +257,8 @@ shared-libraries:,\ local icons_mimetypes="0" local infopages="0" local manpages="0" + local pck_devel="0" + local pck_library="0" local pck_apidocs="0" local pck_tools="0" local shared_libraries="0" @@ -290,6 +295,10 @@ shared-libraries:,\ infopages="$2"; shift ;; --manpages) manpages="$2"; shift ;; + --pck-devel) + pck_devel="$2"; shift ;; + --pck-library) + pck_library="$2"; shift ;; --pck-apidocs) pck_apidocs="$2"; shift ;; --pck-tools) @@ -374,7 +383,7 @@ $FUNCNAME: @fi:$currvar lev:$if_level val:${if_value[$if_level]})" @configure@) [ "$spec_cmd_configure" ] && echo "$line" | \ sed "s,@configure@,$spec_cmd_configure," - ;; + ;; *) [ "${if_value[1]}" = '1' -a ${if_value[2]} = '1' ] && echo "$line" | sed "\ s,@DISTRO@,${DISTRO:-?DISTRO?}, @@ -777,6 +786,13 @@ grep -e "enable-gtk-doc")" ] && { $spec_cmd_configure_autotools --enable-gtk-doc" } + # 11. check for library packages + local pck_library="0" + local pck_tools="1" + case "$spec_type" in library) + [[ "$pck_name" =~ ^lib* ]] || + { pck_library="1"; pck_tools="0"; } + esac # FIXME: missing support for: # pkgconfig files @@ -799,7 +815,9 @@ $spec_cmd_configure_autotools --enable-gtk-doc" --infopages "$spec_infopages" \ --manpages "$spec_manpages" \ --pck-apidocs "$spec_gtk_doc" \ - --pck-tools "1" \ + --pck-devel "1" \ + --pck-library "$pck_library" \ + --pck-tools "$pck_tools" \ --shared-libraries "1" [ "$outfile" ] && specfile.ckeck_defvalues "$outfile" diff --git a/templates/library b/templates/library index 2c15b0b..879779c 100644 --- a/templates/library +++ b/templates/library @@ -2,7 +2,11 @@ Name: @pck_name@ Version: @pck_version@ Release: @spec_first_release@@DISTRO_rpm@ Summary: ... +@if:pck_library +Group: ... +@else:pck_library Group: System/Libraries +@fi:pck_library Vendor: @VENDOR@ Distribution: @DISTRO@ Packager: @packager_fullname@ <@packager_email@> @@ -21,14 +25,37 @@ BuildRoot: @rpm_default_buildroot@ %description ... -%package devel -Group: Development/Libraries -Summary: Static libraries and headers for %{name} -Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +@if:pck_library +%package -n lib%{name} +Group: System/Libraries +Summary: Shared libraries for %{name} +%description -n lib%{name} +This package contains shared libraries for %{name}. +@fi:pck_library + +@if:pck_devel +@if:pck_library +%package -n lib%{name}-devel +@else:pck_library +%package devel +@fi:pck_library +Group: Development/Libraries +Summary: Development files for %{name} +@if:pck_library +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} +@else:pck_library +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +@fi:pck_library + +@if:pck_library +%description -n lib%{name}-devel +@else:pck_library %description devel +@fi:pck_library ... -This package contains static libraries and header files need for development. +This package contains libraries and header files for developing applications that use %{name}. +@fi:pck_devel @if:pck_tools %package tools @@ -37,7 +64,7 @@ Summary: Utility applications for %{name} Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description tools -The %{name}-tools package contains utility applications for %{name}. +This package contains utility applications for %{name}. @fi:pck_tools @if:pck_apidocs @@ -74,16 +101,29 @@ This package includes the %{name} API documentation. %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +@if:pck_library +%post -n lib%{name} -p /sbin/ldconfig +%postun -n lib%{name} -p /sbin/ldconfig +@else:pck_library %post -p /sbin/ldconfig %postun -p /sbin/ldconfig +@fi:pck_library @if:infopages +@if:pck_library +%post -n lib%{name}-devel +@else:pck_library %post devel +@fi:pck_library ## modify the infopage name as required %install_info %{name}.info exit 0 +@if:pck_library +%preun -n lib%{name}-devel +@else:pck_library %preun devel +@fi:pck_library ## modify the infopage name as required %uninstall_info %{name}.info exit 0 @@ -96,11 +136,26 @@ exit 0 @fi:i18n %defattr(-,root,root) ## note: this list is just an example; modify as required +@if:pck_library +@else:pck_library # %{_libdir}/*.so.* +@fi:pck_library # %{_mandir}/man1/* @standard_docs@ +@if:pck_library +%files -n lib%{name} +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_libdir}/*.so.* +@fi:pck_library + +@if:pck_devel +@if:pck_library +%files -n lib%{name}-devel +@else:pck_library %files devel +@fi:pck_library %defattr(-,root,root) ## note: this list is just an example; modify as required # %{_bindir}/%{name}-config @@ -116,6 +171,7 @@ exit 0 # %{_infodir}/*.info.* @fi:infopages @standard_docs_devel@ +@fi:pck_devel @if:pck_tools %files tools