1
0

- remove braces from rpm macros

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ocaml/ocaml-rpm-macros?expand=0&rev=69
This commit is contained in:
Olaf Hering 2022-03-17 22:23:24 +00:00 committed by Git OBS Bridge
parent cbbf3354ad
commit 2ddfc738f8
2 changed files with 106 additions and 105 deletions

View File

@ -3,6 +3,7 @@ Tue Feb 22 22:22:22 UTC 2022 - ohering@suse.de
- remove usage of external-lib-deps for dune3 - remove usage of external-lib-deps for dune3
- define ocaml_dune_bootstrap_directory for dune3 - define ocaml_dune_bootstrap_directory for dune3
- remove braces from rpm macros
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Oct 27 07:31:27 UTC 2021 - ohering@suse.de Wed Oct 27 07:31:27 UTC 2021 - ohering@suse.de

View File

@ -33,9 +33,9 @@ Source1: ocaml-findlib.rpm.prov_req.attr.sh
# Some rpm variants are unable to create proper debuginfo and/or debugsource packages # Some rpm variants are unable to create proper debuginfo and/or debugsource packages
%bcond_without suse_ocaml_opt_debug_package %bcond_without suse_ocaml_opt_debug_package
# Some rpm variants fail to build even this innocent package... # Some rpm variants fail to build even this innocent package...
%define debug_package %{nil} %define debug_package %nil
%define ocaml_standard_library %{_libdir}/ocaml %define ocaml_standard_library %_libdir/ocaml
# macros to be set in prjconf: # macros to be set in prjconf:
#Macros: #Macros:
#_with_ocaml_make_testsuite 1 #_with_ocaml_make_testsuite 1
@ -57,20 +57,20 @@ in ocaml spec files.
%install %install
> files.fileattrs > files.fileattrs
if test -d '%{_rpmconfigdir}/fileattrs' if test -d '%_rpmconfigdir/fileattrs'
then then
# Generating dependencies can currently only be done by rpm versions # Generating dependencies can currently only be done by rpm versions
# which support "fileattrs", because it is easy to add new hooks. # which support "fileattrs", because it is easy to add new hooks.
mkdir -vp %{buildroot}%{_rpmconfigdir}/fileattrs mkdir -vp %buildroot%_rpmconfigdir/fileattrs
# Map ocamlobjinfo output to rpm Provides/Requires # Map ocamlobjinfo output to rpm Provides/Requires
# This tag name MUST match what ocaml.spec uses internally # This tag name MUST match what ocaml.spec uses internally
tag="suseocaml" tag="suseocaml"
file_attr="%{_rpmconfigdir}/fileattrs/${tag}.attr" file_attr="%_rpmconfigdir/fileattrs/${tag}.attr"
file_sh="%{_rpmconfigdir}/${tag}.sh" file_sh="%_rpmconfigdir/${tag}.sh"
attr_sh="%%{_rpmconfigdir}/${tag}.sh" attr_sh="%%_rpmconfigdir/${tag}.sh"
tee %{buildroot}${file_sh} < %{SOURCE0} tee %buildroot${file_sh} < %{SOURCE0}
tee %{buildroot}${file_attr} <<_EOF_ tee %buildroot${file_attr} <<_EOF_
%%__${tag}_provides ${attr_sh} --provides %%__${tag}_provides ${attr_sh} --provides
%%__${tag}_requires ${attr_sh} --requires %%__${tag}_requires ${attr_sh} --requires
%%__${tag}_magic ^(Objective caml|OCaml) .*$ %%__${tag}_magic ^(Objective caml|OCaml) .*$
@ -82,14 +82,14 @@ _EOF_
# Map findlib names to rpm Provides/Requires # Map findlib names to rpm Provides/Requires
tag="suseocamlfind" tag="suseocamlfind"
file_attr="%{_rpmconfigdir}/fileattrs/${tag}.attr" file_attr="%_rpmconfigdir/fileattrs/${tag}.attr"
file_sh="%{_rpmconfigdir}/${tag}.sh" file_sh="%_rpmconfigdir/${tag}.sh"
attr_sh="%%{_rpmconfigdir}/${tag}.sh" attr_sh="%%_rpmconfigdir/${tag}.sh"
tee %{buildroot}${file_sh} < %{SOURCE1} tee %buildroot${file_sh} < %{SOURCE1}
tee %{buildroot}${file_attr} <<_EOF_ tee %buildroot${file_attr} <<_EOF_
%%__${tag}_provides ${attr_sh} -prov %%__${tag}_provides ${attr_sh} -prov
%%__${tag}_requires ${attr_sh} -req %%__${tag}_requires ${attr_sh} -req
%%__${tag}_path ^%{ocaml_standard_library}/.*/META$|^%{ocaml_standard_library}/META$ %%__${tag}_path ^%ocaml_standard_library/.*/META$|^%ocaml_standard_library/META$
_EOF_ _EOF_
echo "${file_attr}" >> files.fileattrs echo "${file_attr}" >> files.fileattrs
echo "%%attr(755,root,root) ${file_sh}" >> files.fileattrs echo "%%attr(755,root,root) ${file_sh}" >> files.fileattrs
@ -97,36 +97,36 @@ fi
# #
# install OCaml macros # install OCaml macros
mkdir -vp %{buildroot}%{_rpmmacrodir} mkdir -vp %buildroot%_rpmmacrodir
tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_' tee %buildroot%_rpmmacrodir/macros.%name <<'_EOF_'
# Guidelines: # Guidelines:
# - Providing applications written in OCaml is the main goal of our packaging. # - Providing applications written in OCaml is the main goal of our packaging.
# - Applications written in OCaml are static binaries. # - Applications written in OCaml are static binaries.
# - A concept of shared libraries does not exist, beside the Dynlink module # - A concept of shared libraries does not exist, beside the Dynlink module
# - All binaries go into the main package, in case they are produced. # - All binaries go into the main package, in case they are produced.
# - All modules go into the -devel subpackage # - All modules go into the -devel subpackage
# - Helper applications below %{ocaml_standard_library} go into the -devel subpackage # - Helper applications below %ocaml_standard_library go into the -devel subpackage
# - License files go into the main package. # - License files go into the main package.
# - To aid debugging of cmxs files, their debuginfo is preserved by removing the executable bit. # - To aid debugging of cmxs files, their debuginfo is preserved by removing the executable bit.
# #
# get rid of %{_rpmconfigdir}/find-debuginfo.sh # get rid of %_rpmconfigdir/find-debuginfo.sh
# strip kills the bytecode part of ELF binaries # strip kills the bytecode part of ELF binaries
# #
# provide empty _find_debuginfo_dwz_opts # provide empty _find_debuginfo_dwz_opts
# the .dwz files contains identical contents, which leads to identical # the .dwz files contains identical contents, which leads to identical
# checksums, which leads to file conflicts due to identical symlinks # checksums, which leads to file conflicts due to identical symlinks
%%ocaml_standard_library %{ocaml_standard_library} %%ocaml_standard_library %ocaml_standard_library
%if %{without suse_ocaml_opt_debug_package} %if %{without suse_ocaml_opt_debug_package}
# Obviously, handling presence or absence of debug information works only when being built in a SUSE system. # Obviously, handling presence or absence of debug information works only when being built in a SUSE system.
%endif %endif
%%ocaml_preserve_bytecode \ %%ocaml_preserve_bytecode \
%if %{without suse_ocaml_opt_debug_package} %if %{without suse_ocaml_opt_debug_package}
%%define debug_package %%{nil} \ %%define debug_package %%nil \
%%define __debug_install_post %%{nil} \ %%define __debug_install_post %%nil \
%endif %endif
%%define _lto_cflags %%{nil} \ %%define _lto_cflags %%nil \
%%{nil} %%nil
%%_find_debuginfo_dwz_opts %%{nil} %%_find_debuginfo_dwz_opts %%nil
# Compatibility for quilt setup and old packages # Compatibility for quilt setup and old packages
%%ocaml_native_compiler 1 %%ocaml_native_compiler 1
@ -136,12 +136,12 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
# Files with known extensions or names are written to 'files' or 'files.devel' # Files with known extensions or names are written to 'files' or 'files.devel'
# Other unknown files are shown on stdout # Other unknown files are shown on stdout
%%ocaml_create_file_list \ %%ocaml_create_file_list \
> %%{name}.files ;\ > %%name.files ;\
> %%{name}.files.changes ;\ > %%name.files.changes ;\
> %%{name}.files.devel ;\ > %%name.files.devel ;\
> %%{name}.files.ldsoconf ;\ > %%name.files.ldsoconf ;\
> %%{name}.files.license ;\ > %%name.files.license ;\
> %%{name}.files.unhandled ;\ > %%name.files.unhandled ;\
for changes in \\\ for changes in \\\
CHANGELOG.md \\\ CHANGELOG.md \\\
CHANGES \\\ CHANGES \\\
@ -151,7 +151,7 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
Changelog \\\ Changelog \\\
;\ ;\
do\ do\
test -f "${changes}" && echo "%%%%doc ${changes}" >> '%%{name}.files.changes' ;\ test -f "${changes}" && echo "%%%%doc ${changes}" >> '%%name.files.changes' ;\
done ;\ done ;\
for license in \\\ for license in \\\
COPYING \\\ COPYING \\\
@ -171,17 +171,17 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
%else %else
license_macro='doc' ;\ license_macro='doc' ;\
%endif %endif
test -f "${license}" && echo "%%%%${license_macro} ${license}" >> '%%{name}.files.license' ;\ test -f "${license}" && echo "%%%%${license_macro} ${license}" >> '%%name.files.license' ;\
done ;\ done ;\
find %%{buildroot}%%{ocaml_standard_library} -name '*.cmxs' -exec chmod -v a-x '{}' + ;\ find %%buildroot%%ocaml_standard_library -name '*.cmxs' -exec chmod -v a-x '{}' + ;\
find %%{buildroot}%%{ocaml_standard_library} ! -type d | awk\\\ find %%buildroot%%ocaml_standard_library ! -type d | awk\\\
-v "buildroot=%%{buildroot}"\\\ -v "buildroot=%%buildroot"\\\
-v "ocaml_standard_library=%%{ocaml_standard_library}"\\\ -v "ocaml_standard_library=%%ocaml_standard_library"\\\
-v "out_files_main=%%{name}.files"\\\ -v "out_files_main=%%name.files"\\\
-v "out_files_devel=%%{name}.files.devel"\\\ -v "out_files_devel=%%name.files.devel"\\\
-v "out_files_ldconf=%%{name}.files.ldsoconf"\\\ -v "out_files_ldconf=%%name.files.ldsoconf"\\\
-v "out_files_unhandled=%%{name}.files.unhandled"\\\ -v "out_files_unhandled=%%name.files.unhandled"\\\
-v "ocaml_ldconf=$(ls -1d %%{ocaml_standard_library}/ld.conf || : ld.conf not found)"\\\ -v "ocaml_ldconf=$(ls -1d %%ocaml_standard_library/ld.conf || : ld.conf not found)"\\\
'\ '\
BEGIN {\ BEGIN {\
nr=0\ nr=0\
@ -341,74 +341,74 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
END {\ END {\
;\ ;\
}' ;\ }' ;\
cat '%%{name}.files.changes' >> '%%{name}.files' ;\ cat '%%name.files.changes' >> '%%name.files' ;\
cat '%%{name}.files.license' >> '%%{name}.files' ;\ cat '%%name.files.license' >> '%%name.files' ;\
if test -s %%{name}.files.ldsoconf ;\ if test -s %%name.files.ldsoconf ;\
then\ then\
ldsoconfd='/etc/ld.so.conf.d' ;\ ldsoconfd='/etc/ld.so.conf.d' ;\
mkdir -vp "%%{buildroot}${ldsoconfd}" ;\ mkdir -vp "%%buildroot${ldsoconfd}" ;\
tee "%%{buildroot}${ldsoconfd}/%%{name}.conf" < %%{name}.files.ldsoconf ;\ tee "%%buildroot${ldsoconfd}/%%name.conf" < %%name.files.ldsoconf ;\
echo "%config ${ldsoconfd}/%%{name}.conf" >> %%{name}.files.devel ;\ echo "%config ${ldsoconfd}/%%name.conf" >> %%name.files.devel ;\
fi ;\ fi ;\
for i in \\\ for i in \\\
%%{name}.files \\\ %%name.files \\\
%%{name}.files.devel \\\ %%name.files.devel \\\
%%{name}.files.ldsoconf \\\ %%name.files.ldsoconf \\\
%%{name}.files.unhandled \\\ %%name.files.unhandled \\\
;\ ;\
do\ do\
sort -u $i > $$ ;\ sort -u $i > $$ ;\
mv $$ $i ;\ mv $$ $i ;\
done ;\ done ;\
%%{nil} %%nil
# setup.ml comes from oasis, but this is here for libs oasis depends on # setup.ml comes from oasis, but this is here for libs oasis depends on
# #
# html goes into a separate, browsable dir # html goes into a separate, browsable dir
# which is also safe regarding wiping due to %%doc macro usage # which is also safe regarding wiping due to %%doc macro usage
%%_oasis_docdir_base %%{_datadir}/doc/ocaml %%_oasis_docdir_base %%_datadir/doc/ocaml
%%_oasis_docdir_dvi %%{_oasis_docdir_base}/%%{name} %%_oasis_docdir_dvi %%_oasis_docdir_base/%%name
%%_oasis_docdir_html %%{_oasis_docdir_base}/%%{name} %%_oasis_docdir_html %%_oasis_docdir_base/%%name
%%_oasis_docdir_pdf %%{_oasis_docdir_base}/%%{name} %%_oasis_docdir_pdf %%_oasis_docdir_base/%%name
%%_oasis_docdir_ps %%{_oasis_docdir_base}/%%{name} %%_oasis_docdir_ps %%_oasis_docdir_base/%%name
%%oasis_docdir %%{_oasis_docdir_base}/%%{name} %%oasis_docdir %%_oasis_docdir_base/%%name
# #
# For now provide a convinience macro which covers also the parent dir # For now provide a convinience macro which covers also the parent dir
%%oasis_docdir_dvi %%dir %%{_oasis_docdir_base} \ %%oasis_docdir_dvi %%dir %%_oasis_docdir_base \
%%{_oasis_docdir_dvi} %%_oasis_docdir_dvi
%%oasis_docdir_html %%dir %%{_oasis_docdir_base} \ %%oasis_docdir_html %%dir %%_oasis_docdir_base \
%%{_oasis_docdir_html} %%_oasis_docdir_html
%%oasis_docdir_pdf %%dir %%{_oasis_docdir_base} \ %%oasis_docdir_pdf %%dir %%_oasis_docdir_base \
%%{_oasis_docdir_pdf} %%_oasis_docdir_pdf
%%oasis_docdir_ps %%dir %%{_oasis_docdir_base} \ %%oasis_docdir_ps %%dir %%_oasis_docdir_base \
%%{_oasis_docdir_ps} %%_oasis_docdir_ps
# #
# various macros to unify setup/build/install # various macros to unify setup/build/install
%%oasis_setup \ %%oasis_setup \
oasis setup oasis setup
%%ocaml_oasis_configure \ %%ocaml_oasis_configure \
ocaml setup.ml -configure \\\ ocaml setup.ml -configure \\\
--psdir %%{_oasis_docdir_ps} \\\ --psdir %%_oasis_docdir_ps \\\
--pdfdir %%{_oasis_docdir_pdf} \\\ --pdfdir %%_oasis_docdir_pdf \\\
--dvidir %%{_oasis_docdir_dvi} \\\ --dvidir %%_oasis_docdir_dvi \\\
--htmldir %%{_oasis_docdir_html} \\\ --htmldir %%_oasis_docdir_html \\\
--docdir %%{oasis_docdir} \\\ --docdir %%oasis_docdir \\\
--localedir %%{_datadir}/locale \\\ --localedir %%_datadir/locale \\\
--datadir %%{_datadir} \\\ --datadir %%_datadir \\\
\\\ \\\
--bindir %%{_bindir} \\\ --bindir %%_bindir \\\
--mandir %%{_mandir} \\\ --mandir %%_mandir \\\
--destdir %%{buildroot} \\\ --destdir %%buildroot \\\
--datarootdir %%{_datadir} \\\ --datarootdir %%_datadir \\\
--infodir %%{_infodir} \\\ --infodir %%_infodir \\\
--libdir %%{_libdir} \\\ --libdir %%_libdir \\\
--libexecdir %%{_libexecdir} \\\ --libexecdir %%_libexecdir \\\
--localstatedir %%{_localstatedir} \\\ --localstatedir %%_localstatedir \\\
--sbindir %%{_sbindir} \\\ --sbindir %%_sbindir \\\
--prefix %%{_prefix} \\\ --prefix %%_prefix \\\
--sysconfdir %%{_sysconfdir} \\\ --sysconfdir %%_sysconfdir \\\
--exec-prefix %%{_prefix} \\\ --exec-prefix %%_prefix \\\
--sharedstatedir %%{_sharedstatedir} --sharedstatedir %%_sharedstatedir
# #
%%ocaml_oasis_build \ %%ocaml_oasis_build \
ocaml setup.ml -build ocaml setup.ml -build
@ -417,14 +417,14 @@ ocaml setup.ml -configure \\\
%%ocaml_oasis_install \ %%ocaml_oasis_install \
ocaml setup.ml -install ocaml setup.ml -install
%%ocaml_oasis_findlib_install \ %%ocaml_oasis_findlib_install \
export OCAMLFIND_DESTDIR=%%{buildroot}%%{ocaml_standard_library} ; \ export OCAMLFIND_DESTDIR=%%buildroot%%ocaml_standard_library ; \
export OCAMLFIND_LDCONF=/dev/null ; \ export OCAMLFIND_LDCONF=/dev/null ; \
mkdir -p $OCAMLFIND_DESTDIR ; \ mkdir -p $OCAMLFIND_DESTDIR ; \
ocaml setup.ml -install ocaml setup.ml -install
%%ocaml_oasis_test \ %%ocaml_oasis_test \
ocaml setup.ml -test ocaml setup.ml -test
# #
%%ocaml_dune_bootstrap_directory %%{_libexecdir}/dune-bootstrap %%ocaml_dune_bootstrap_directory %%_libexecdir/dune-bootstrap
%%ocaml_dune_setup \ %%ocaml_dune_setup \
%ifarch ppc64 ppc64le %ifarch ppc64 ppc64le
ulimit -s $((1024 * 64)) ; \ ulimit -s $((1024 * 64)) ; \
@ -436,7 +436,7 @@ ocaml setup.ml -configure \\\
then \ then \
test -f 'opam' && mv -v 'opam' "${dune_release_pkgs}.opam" ; \ test -f 'opam' && mv -v 'opam' "${dune_release_pkgs}.opam" ; \
fi ; \ fi ; \
echo '%%{version}' | tee VERSION ; \ echo '%%version' | tee VERSION ; \
for opam in *.opam \ for opam in *.opam \
do\ do\
test -f "${opam}" || continue ; \ test -f "${opam}" || continue ; \
@ -449,7 +449,7 @@ ocaml setup.ml -configure \\\
then \ then \
sed -i~ '\ sed -i~ '\
/^([[:blank:]]*version[[:blank:]]\\+/d\ /^([[:blank:]]*version[[:blank:]]\\+/d\
/^([[:blank:]]*lang[[:blank:]]\\+dune[[:blank:]]/a (version %%{version})\ /^([[:blank:]]*lang[[:blank:]]\\+dune[[:blank:]]/a (version %%version)\
' 'dune-project'; \ ' 'dune-project'; \
diff -u "$_"~ "$_" || : got version ; \ diff -u "$_"~ "$_" || : got version ; \
fi ; \ fi ; \
@ -457,11 +457,11 @@ ocaml setup.ml -configure \\\
: dune_release_pkgs \ : dune_release_pkgs \
if test -n "${dune_release_pkgs}" ; \ if test -n "${dune_release_pkgs}" ; \
then \ then \
echo "${dune_release_pkgs}" > dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \ echo "${dune_release_pkgs}" > dune_release_pkgs-%%name-%%version-%%release ; \
dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \ dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \
fi ; \ fi ; \
dune installed-libraries $OCAML_DUNE_INSTALLED_LIBRARIES_ARGS ; \ dune installed-libraries $OCAML_DUNE_INSTALLED_LIBRARIES_ARGS ; \
%%{nil} %%nil
%%ocaml_dune_build \ %%ocaml_dune_build \
if test -z "${_smp_mflags}" ;\ if test -z "${_smp_mflags}" ;\
then \ then \
@ -492,33 +492,33 @@ ocaml setup.ml -configure \\\
esac ;\ esac ;\
fi ;\ fi ;\
dune_for_release= ;\ dune_for_release= ;\
if test -f dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \ if test -f dune_release_pkgs-%%name-%%version-%%release ; \
then \ then \
read dune_release_pkgs < dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \ read dune_release_pkgs < dune_release_pkgs-%%name-%%version-%%release ; \
dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \ dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \
fi ;\ fi ;\
dune install \\\ dune install \\\
--verbose \\\ --verbose \\\
${dune_for_release} \\\ ${dune_for_release} \\\
${_smp_mflags} \\\ ${_smp_mflags} \\\
--prefix=%%{_prefix} \\\ --prefix=%%_prefix \\\
--libdir=%%{ocaml_standard_library} \\\ --libdir=%%ocaml_standard_library \\\
--destdir=%%{buildroot} \\\ --destdir=%%buildroot \\\
${dune_release_pkgs//,/ } \\\ ${dune_release_pkgs//,/ } \\\
$OCAML_DUNE_INSTALL_ARGS ;\ $OCAML_DUNE_INSTALL_ARGS ;\
rm -rfv %%{buildroot}%%{_prefix}/doc ;\ rm -rfv %%buildroot%%_prefix/doc ;\
if test -d %%{buildroot}%%{_prefix}/man ; then \ if test -d %%buildroot%%_prefix/man ; then \
mkdir -vp %%{buildroot}%%{_datadir} ; \ mkdir -vp %%buildroot%%_datadir ; \
mv -vt %%{buildroot}%%{_datadir} %%{buildroot}%%{_prefix}/man ; \ mv -vt %%buildroot%%_datadir %%buildroot%%_prefix/man ; \
fi ; fi ;
%%ocaml_dune_test \ %%ocaml_dune_test \
%ifarch ppc64 ppc64le %ifarch ppc64 ppc64le
ulimit -s $((1024 * 64)) ; \ ulimit -s $((1024 * 64)) ; \
%endif %endif
dune_for_release= ; \ dune_for_release= ; \
if test -f dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \ if test -f dune_release_pkgs-%%name-%%version-%%release ; \
then \ then \
read dune_release_pkgs < dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \ read dune_release_pkgs < dune_release_pkgs-%%name-%%version-%%release ; \
dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \ dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \
fi ; \ fi ; \
if dune runtest \\\ if dune runtest \\\
@ -544,6 +544,6 @@ _EOF_
%files -f files.fileattrs %files -f files.fileattrs
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_rpmmacrodir}/* %_rpmmacrodir/*
%changelog %changelog