[ghc-rpm-macros] large update for simplified reworked revision of Packaging Guidelines

Jens Petersen petersen at fedoraproject.org
Tue Apr 23 09:15:22 UTC 2013


commit 73b0bd180f65887308a6738120755d0b0ec2ff66
Author: Jens Petersen <petersen at redhat.com>
Date:   Tue Apr 23 18:12:25 2013 +0900

    large update for simplified reworked revision of Packaging Guidelines
    
    - see https://fedorahosted.org/fpc/ticket/194 for discussion
    - move section and multiple library metamacros to new extra subpackage
    - packaging no longer depends on availability of shared libs
      so is same now for all primary and secondary archs: ie there is always
      a binary base library package
    - drop ghc_add_basepkg_file macro and ghc_exclude_docdir

 ghc-rpm-macros.ghc       |  160 +--------------------------------------------
 ghc-rpm-macros.ghc-extra |  120 ++++++++++++++++++++++++++++++++++
 ghc-rpm-macros.spec      |   38 +++++++++--
 3 files changed, 154 insertions(+), 164 deletions(-)
---
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index ea3aa91..428b682 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -1,5 +1,5 @@
 # RPM Macros for packaging Haskell cabalized packages  -*-rpm-spec-*-
-# see https://fedoraproject.org/wiki/PackagingDrafts/Haskell for more details
+# see https://fedoraproject.org/wiki/Packaging:Haskell for more details
 
 # "cabal"
 %cabal [ -x Setup ] || ghc --make %{!?ghc_user_conf:-no-user-package-conf} %{!?ghc_without_dynamic:-dynamic} Setup\
@@ -43,28 +43,11 @@ fi
 %define docdir %{ghclibdocdir}/%{pkgnamever}\
 rm -f %{basepkg}.files %{basepkg}-devel.files\
 if [ -d "%{buildroot}%{pkgdir}" ]; then\
-echo "%dir %{pkgdir}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
+echo "%dir %{pkgdir}" >> %{basepkg}.files\
 %if %{undefined ghc_without_shared}\
 echo "%attr(755,root,root) %{pkgdir}/libHS%{pkgnamever}-ghc%{ghc_version}.so" >> %{basepkg}.files\
 %endif\
 fi\
-%if %{defined ghc_without_shared}\
-if [ "%{name}" = "%{basepkg}" -o -n "%{?1}" ]; then\
-  if [ -d "%{buildroot}%{_docdir}/%{basepkg}-%{pkgver}" ]; then\
-    mv %{buildroot}%{_docdir}/%{basepkg}-%{pkgver} %{buildroot}%{_docdir}/%{basepkg}-devel-%{pkgver}\
-%if %{undefined ghc_exclude_docdir}\
-    echo "%{_docdir}/%{basepkg}-devel-%{version}" >> %{basepkg}-devel.files\
-%endif\
-  fi\
-fi\
-%endif\
-%if %{undefined ghc_exclude_docdir}\
-if [ -d "%{buildroot}%{_docdir}/%{name}-%{version}" ]; then\
-  echo "%{_docdir}/%{name}-%{version}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
-elif [ -d "%{buildroot}%{_docdir}/ghc-%{pkgnamever}" ]; then\
-  echo "%{_docdir}/ghc-%{pkgnamever}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
-fi\
-%endif\
 echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
 if [ -d "%{buildroot}%{pkgdir}" ]; then\
 find %{buildroot}%{pkgdir} -mindepth 1 -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
@@ -73,17 +56,13 @@ fi\
 if [ -d "%{buildroot}%{docdir}" ]; then\
 echo "%{docdir}" >> %{basepkg}-devel.files\
 fi\
-for i in %{!?ghc_without_shared:%{basepkg}.files} %{basepkg}-devel.files; do\
+for i in %{basepkg}.files %{basepkg}-devel.files; do\
 if [ -f "$i" ]; then\
 sed -i -e "s!%{buildroot}!!g" $i\
 fi\
 done\
 %{nil}
 
-%ghc_add_basepkg_file()\
-%define basepkg ghc-%{pkg_name}\
-echo "%*" >> %{basepkg}%{?ghc_without_shared:-devel}.files
-
 # compiler version
 %ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
 
@@ -102,139 +81,10 @@ install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
 %ghc_devel_requires Requires:       ghc-compiler = %{ghc_version}\
 Requires(post): ghc-compiler = %{ghc_version}\
 Requires(postun): ghc-compiler = %{ghc_version}\
-%if %{undefined ghc_without_shared} && 0%{!?-m:1}\
-Requires:       ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
-%endif
-
-%ghc_shared_files\
-%if %{undefined ghc_without_shared}\
-%files -n %{basepkg} -f %{basepkg}.files\
-%{?base_doc_files:%doc %base_doc_files}\
-%endif\
-%{nil}
-
-# ghc_lib_package [-c cdepslist] [-h pkgdepslist]
-%ghc_lib_package(c:h:)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%ghc_shared_files\
-\
-%ghc_package_devel\
-%{nil}
-
-# ghc_package [-l licensetag] [name] [version]
-%ghc_package(l:)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define pkgver %{?2}%{!?2:%{version}}\
-%define basepkg ghc-%{pkgname}\
-%package -n %{basepkg}\
-Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}\
-Group:          System Environment/Libraries\
-%{?1:Version:        %{pkgver}}\
-%{-l:License:        %{-l*}}\
-%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}
-
-# ghc_description [name] [version]
-%ghc_description()\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%description -n %{basepkg}\
-%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
-%if %{defined ghc_version} && %{undefined ghc_without_shared}\
-This package provides the shared library.\
-%endif
-
-# ghc_lib_subpackage [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-x] [name] [version]
-%ghc_lib_subpackage(c:h:l:x)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define pkgver %{?2}%{!?2:%{version}}\
-%define pkgnamever %{pkgname}-%{pkgver}\
-%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
-%define basepkg ghc-%{pkgname}\
-%ghc_package\
-\
-%ghc_description\
-\
-%ghc_lib_package\
-%{nil}
+Requires:       ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}
 
 %ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || :
 
-# (deprecated) for docs post and postun
-%ghc_reindex_haddock :
-
-%ghc_devel_files\
-%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
-%if %{defined ghc_without_shared}\
-%{?base_doc_files:%doc %base_doc_files}\
-%endif\
-%{?devel_doc_files:%doc %devel_doc_files}\
-%{nil}
-
-%ghc_files()\
-%{?1:%define base_doc_files %*}\
-%define basepkg ghc-%{pkg_name}\
-%ghc_shared_files\
-\
-%ghc_devel_files\
-%{nil}
-
-# ghc_devel_package [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-m] [name] [version]
-#  -m : meta-package
-%ghc_devel_package(c:h:l:m)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define pkgver %{?2}%{!?2:%{version}}\
-%define basepkg ghc-%{pkgname}\
-%package -n %{basepkg}-devel\
-Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
-Group:          Development/Libraries\
-%{?1:Version:        %{pkgver}}\
-%{-l:License:        %{-l*}}\
-%{?ghc_devel_requires}\
-%{-h:Requires:       %{-h*}}\
-%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}\
-%{-c:Requires:       %{-c*}}\
-%{?ghc_pkg_obsoletes:Obsoletes:      %{ghc_pkg_obsoletes}}\
-%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
-Obsoletes:      %{basepkg}-doc < %{pkgver}-%{release}\
-Provides:       %{basepkg}-doc = %{pkgver}-%{release}\
-Obsoletes:      %{basepkg}-prof < %{pkgver}-%{release}\
-%if %{undefined without_prof}\
-Provides:       %{basepkg}-prof = %{pkgver}-%{release}\
-%endif
-
-# ghc_devel_description
-%ghc_devel_description()\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%description -n %{basepkg}-devel\
-%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
-\
-This package contains the development files.
-
-# ghc_devel_post_postun
-%ghc_devel_post_postun()\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%post -n %{basepkg}-devel\
-%ghc_pkg_recache\
-\
-%postun -n %{basepkg}-devel\
-%ghc_pkg_recache
-
-# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag] [name] [version]
-%ghc_package_devel(c:h:l:)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%ghc_devel_package\
-\
-%ghc_devel_description\
-\
-%ghc_devel_post_postun\
-\
-%ghc_devel_files\
-%{nil}
-
 # ghc_strip_dynlinked
 %ghc_strip_dynlinked\
 %if %{undefined __debug_package}\
@@ -312,5 +162,3 @@ done\
 %global ghc_without_shared 1\
 %global ghc_without_dynamic 1\
 %ghc_test
-
-%ghc_exclude_docdir 1
diff --git a/ghc-rpm-macros.ghc-extra b/ghc-rpm-macros.ghc-extra
new file mode 100644
index 0000000..c778293
--- /dev/null
+++ b/ghc-rpm-macros.ghc-extra
@@ -0,0 +1,120 @@
+# RPM Macros for packaging Haskell packages with multiple libs  -*-rpm-spec-*-
+
+%ghc_shared_files\
+%files -n %{basepkg} -f %{basepkg}.files\
+%{?base_doc_files:%doc %base_doc_files}\
+%{nil}
+
+# ghc_lib_package [-c cdepslist] [-h pkgdepslist]
+%ghc_lib_package(c:h:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%ghc_shared_files\
+\
+%ghc_package_devel\
+%{nil}
+
+# ghc_package [-l licensetag] [name] [version]
+%ghc_package(l:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}\
+Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}\
+%{?1:Version:        %{pkgver}}\
+%{-l:License:        %{-l*}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}
+
+# ghc_description [name] [version]
+%ghc_description()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%description -n %{basepkg}\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}
+
+# ghc_lib_subpackage [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-x] [name] [version]
+%ghc_lib_subpackage(c:h:l:x)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
+%define basepkg ghc-%{pkgname}\
+%ghc_package\
+\
+%ghc_description\
+\
+%ghc_lib_package\
+%{nil}
+
+%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || :
+
+# (deprecated) for docs post and postun
+%ghc_reindex_haddock :
+
+%ghc_devel_files\
+%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
+%{?devel_doc_files:%doc %devel_doc_files}\
+%{nil}
+
+%ghc_files()\
+%{?1:%define base_doc_files %*}\
+%define basepkg ghc-%{pkg_name}\
+%ghc_shared_files\
+\
+%ghc_devel_files\
+%{nil}
+
+# ghc_devel_package [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-m] [name] [version]
+#  -m : meta-package
+%ghc_devel_package(c:h:l:m)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}-devel\
+Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
+%{?1:Version:        %{pkgver}}\
+%{-l:License:        %{-l*}}\
+%{?ghc_devel_requires}\
+%{-h:Requires:       %{-h*}}\
+%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}\
+%{-c:Requires:       %{-c*}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %{ghc_pkg_obsoletes}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
+Obsoletes:      %{basepkg}-doc < %{pkgver}-%{release}\
+Provides:       %{basepkg}-doc = %{pkgver}-%{release}\
+Obsoletes:      %{basepkg}-prof < %{pkgver}-%{release}\
+%if %{undefined without_prof}\
+Provides:       %{basepkg}-prof = %{pkgver}-%{release}\
+%endif
+
+# ghc_devel_description
+%ghc_devel_description()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%description -n %{basepkg}-devel\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
+\
+This package contains the development files.
+
+# ghc_devel_post_postun
+%ghc_devel_post_postun()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%post -n %{basepkg}-devel\
+%ghc_pkg_recache\
+\
+%postun -n %{basepkg}-devel\
+%ghc_pkg_recache
+
+# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag] [name] [version]
+%ghc_package_devel(c:h:l:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%ghc_devel_package\
+\
+%ghc_devel_description\
+\
+%ghc_devel_post_postun\
+\
+%ghc_devel_files\
+%{nil}
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 750b4c3..c7700b1 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -1,16 +1,15 @@
 %global debug_package %{nil}
 
-%global macros_file %{_sysconfdir}/rpm/macros.ghc
+%global macros_dir %{_sysconfdir}/rpm
 
 # uncomment to bootstrap without hscolour
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        0.98.1
-Release:        4%{?dist}
-Summary:        Macros for building packages for GHC
+Version:        0.99
+Release:        1%{?dist}
+Summary:        RPM macros for building packages for GHC
 
-Group:          Development/Libraries
 License:        GPLv3
 URL:            https://fedoraproject.org/wiki/Haskell_SIG
 
@@ -24,6 +23,7 @@ Source2:        AUTHORS
 Source3:        ghc-deps.sh
 Source4:        cabal-tweak-dep-ver
 Source5:        cabal-tweak-flag
+Source6:        ghc-rpm-macros.ghc-extra
 Requires:       redhat-rpm-config
 %if %{undefined without_hscolour}
 BuildRequires:  redhat-rpm-config
@@ -37,6 +37,13 @@ of the Fedora Haskell SIG.  ghc needs to be installed in order to make use of
 these macros.
 
 
+%package extra
+Summary:        Extra RPM macros for building Haskell packages with several libs
+Requires:       %{name} = %{version}-%{release}
+
+%description extra
+
+
 %prep
 %setup -c -T
 cp %{SOURCE1} %{SOURCE2} .
@@ -47,7 +54,8 @@ echo no build stage needed
 
 
 %install
-install -p -D -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{macros_file}
+install -p -D -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{macros_dir}/macros.ghc
+install -p -D -m 0644 %{SOURCE6} ${RPM_BUILD_ROOT}/%{macros_dir}/macros.ghc-extra
 
 install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
 
@@ -57,7 +65,7 @@ install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
 # this is why this package is now arch-dependent:
 # turn off shared libs and dynamic linking on secondary archs
 %ifnarch %{ix86} x86_64
-cat >> %{buildroot}/%{macros_file} <<EOF
+cat >> %{buildroot}/%{macros_dir}/macros.ghc <<EOF
 
 # shared libraries are only supported on primary intel archs
 %%ghc_without_dynamic 1
@@ -68,13 +76,27 @@ EOF
 
 %files
 %doc COPYING AUTHORS
-%{macros_file}
+%{macros_dir}/macros.ghc
 %{_prefix}/lib/rpm/ghc-deps.sh
 %{_bindir}/cabal-tweak-dep-ver
 %{_bindir}/cabal-tweak-flag
 
 
+%files extra
+%{macros_dir}/macros.ghc-extra
+
+
 %changelog
+* Tue Apr 23 2013 Jens Petersen <petersen at redhat.com> - 0.99-1
+- update for simplified revised Haskell Packaging Guidelines
+  (https://fedorahosted.org/fpc/ticket/194)
+- packaging for without_shared is now done the same way as shared
+  to make non-shared arch packages same as shared ones:
+  so all archs will now have base library binary packages
+- move spec section metamacros and multiple library packaging macros still
+  needed for ghc and haskell-platform to new extra subpackage
+- drop ghc_add_basepkg_file macro and ghc_exclude_docdir
+
 * Wed Mar 20 2013 Ralf Corsépius <corsepiu at fedoraproject.org> - 0.98.1-4
 - Remove %%config from %%{_sysconfdir}/rpm/macros.*
   (https://fedorahosted.org/fpc/ticket/259).


More information about the scm-commits mailing list