forked from pool/ocaml-rpm-macros
Accepting request 884983 from Archiving:unison:buildrequires
- Use bcond rpm_license_macro for license macro in filelist - Add suse prefix to ocaml_native_compiler to avoid conflict OBS-URL: https://build.opensuse.org/request/show/884983 OBS-URL: https://build.opensuse.org/package/show/devel:languages:ocaml/ocaml-rpm-macros?expand=0&rev=56
This commit is contained in:
parent
4c949ea7cb
commit
b137df16ce
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 9 09:09:09 UTC 2021 - ohering@suse.de
|
||||
|
||||
- Use bcond rpm_license_macro for license macro in filelist
|
||||
- Add suse prefix to ocaml_native_compiler to avoid conflict
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 9 09:09:09 UTC 2021 - ohering@suse.de
|
||||
|
||||
|
@ -17,15 +17,23 @@
|
||||
|
||||
|
||||
Name: ocaml-rpm-macros
|
||||
Version: 20210209
|
||||
Version: 20210409
|
||||
Release: 0
|
||||
Summary: RPM macros for building OCaml source packages
|
||||
License: GPL-2.0-only
|
||||
Group: Development/Languages/OCaml
|
||||
BuildRoot: %_tmppath/%name-%version-build
|
||||
URL: https://build.opensuse.org/project/show/devel:languages:ocaml
|
||||
Source0: ocaml-ocaml.rpm.prov_req.attr.sh
|
||||
Source1: ocaml-findlib.rpm.prov_req.attr.sh
|
||||
|
||||
# Some rpm variants know about license, but can only use them in plain file context
|
||||
%bcond_without suse_ocaml_use_rpm_license_macro
|
||||
# Some rpm variants are unable to create proper debuginfo and/or debugsource packages
|
||||
%bcond_without suse_ocaml_opt_debug_package
|
||||
# Some rpm variants fail to build even this innocent package...
|
||||
%define debug_package %{nil}
|
||||
|
||||
%define ocaml_standard_library %{_libdir}/ocaml
|
||||
%define do_opt 0
|
||||
# macros to be set in prjconf:
|
||||
@ -63,30 +71,45 @@ in ocaml spec files.
|
||||
%build
|
||||
|
||||
%install
|
||||
# map ocamlobjinfo output to rpm Provides/Requires
|
||||
# this tag name MUST match what ocaml.spec uses internally
|
||||
tag="suseocaml"
|
||||
mkdir -vp %{buildroot}%{_rpmconfigdir}/fileattrs
|
||||
tee %{buildroot}%{_rpmconfigdir}/fileattrs/${tag}.attr <<_EOF_
|
||||
%%__${tag}_provides %%{_rpmconfigdir}/${tag}.sh --provides
|
||||
%%__${tag}_requires %%{_rpmconfigdir}/${tag}.sh --requires
|
||||
> files.fileattrs
|
||||
if test -d '%{_rpmconfigdir}/fileattrs'
|
||||
then
|
||||
# Generating dependencies can currently only be done by rpm versions
|
||||
# which support "fileattrs", because it is easy to add new hooks.
|
||||
mkdir -vp %{buildroot}%{_rpmconfigdir}/fileattrs
|
||||
|
||||
# Map ocamlobjinfo output to rpm Provides/Requires
|
||||
# This tag name MUST match what ocaml.spec uses internally
|
||||
tag="suseocaml"
|
||||
file_attr="%{_rpmconfigdir}/fileattrs/${tag}.attr"
|
||||
file_sh="%{_rpmconfigdir}/${tag}.sh"
|
||||
attr_sh="%%{_rpmconfigdir}/${tag}.sh"
|
||||
tee %{buildroot}${file_sh} < %{SOURCE0}
|
||||
tee %{buildroot}${file_attr} <<_EOF_
|
||||
%%__${tag}_provides ${attr_sh} --provides
|
||||
%%__${tag}_requires ${attr_sh} --requires
|
||||
%%__${tag}_magic ^(ELF|Objective caml|OCaml) .*$
|
||||
%%__${tag}_path .(cma|cmi|cmo|cmx|cmxa|cmxs)$
|
||||
%%__${tag}_flags magic_and_path
|
||||
_EOF_
|
||||
#
|
||||
tee %{buildroot}%{_rpmconfigdir}/${tag}.sh < %{SOURCE0}
|
||||
echo "${file_attr}" >> files.fileattrs
|
||||
echo "%%attr(755,root,root) ${file_sh}" >> files.fileattrs
|
||||
|
||||
# map findlib names to rpm Provides/Requires
|
||||
tag="suseocamlfind"
|
||||
mkdir -vp %{buildroot}%{_rpmconfigdir}/fileattrs
|
||||
tee %{buildroot}%{_rpmconfigdir}/fileattrs/${tag}.attr <<_EOF_
|
||||
%%__${tag}_provides %%{_rpmconfigdir}/${tag}.sh -prov
|
||||
%%__${tag}_requires %%{_rpmconfigdir}/${tag}.sh -req
|
||||
# Map findlib names to rpm Provides/Requires
|
||||
tag="suseocamlfind"
|
||||
file_attr="%{_rpmconfigdir}/fileattrs/${tag}.attr"
|
||||
file_sh="%{_rpmconfigdir}/${tag}.sh"
|
||||
attr_sh="%%{_rpmconfigdir}/${tag}.sh"
|
||||
tee %{buildroot}${file_sh} < %{SOURCE1}
|
||||
tee %{buildroot}${file_attr} <<_EOF_
|
||||
%%__${tag}_provides ${attr_sh} -prov
|
||||
%%__${tag}_requires ${attr_sh} -req
|
||||
%%__${tag}_path ^%{ocaml_standard_library}/.*/META$|^%{ocaml_standard_library}/META$
|
||||
_EOF_
|
||||
echo "${file_attr}" >> files.fileattrs
|
||||
echo "%%attr(755,root,root) ${file_sh}" >> files.fileattrs
|
||||
fi
|
||||
#
|
||||
tee %{buildroot}%{_rpmconfigdir}/${tag}.sh < %{SOURCE1}
|
||||
|
||||
# install OCaml macros
|
||||
mkdir -vp %{buildroot}%{_rpmmacrodir}
|
||||
@ -108,11 +131,17 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
|
||||
# the .dwz files contains identical contents, which leads to identical
|
||||
# checksums, which leads to file conflicts due to identical symlinks
|
||||
%%ocaml_standard_library %{ocaml_standard_library}
|
||||
%if %{without suse_ocaml_opt_debug_package}
|
||||
# Obviously, handling presence or absence of debug information works only when being built in a SUSE system.
|
||||
%endif
|
||||
%if %{do_opt}
|
||||
%%ocaml_preserve_bytecode \
|
||||
%if %{without suse_ocaml_opt_debug_package}
|
||||
%%define debug_package %%{nil} \
|
||||
%endif
|
||||
%%define _lto_cflags %%{nil} \
|
||||
%%{nil}
|
||||
%%ocaml_native_compiler 1
|
||||
%%suse_ocaml_native_compiler 1
|
||||
%%_find_debuginfo_dwz_opts %%{nil}
|
||||
%else
|
||||
%%ocaml_preserve_bytecode \
|
||||
@ -120,9 +149,10 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
|
||||
%%define __arch_install_post export NO_BRP_STRIP_DEBUG=true \
|
||||
%%define _lto_cflags %%{nil} \
|
||||
%%{nil}
|
||||
%%ocaml_native_compiler 0
|
||||
%%suse_ocaml_native_compiler 0
|
||||
%endif
|
||||
|
||||
|
||||
# Create file list for base pkg and base-devel pkg
|
||||
# Files with known extensions or names are written to 'files' or 'files.devel'
|
||||
# Other unknown files are shown on stdout
|
||||
@ -157,14 +187,14 @@ tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
|
||||
LICENSE.txt \\\
|
||||
;\
|
||||
do\
|
||||
%if 0%{?suse_version} > 1315
|
||||
%if %{with suse_ocaml_use_rpm_license_macro}
|
||||
license_macro='license' ;\
|
||||
%else
|
||||
license_macro='doc' ;\
|
||||
%endif
|
||||
test -f "${license}" && echo "%%%%${license_macro} ${license}" >> '%%{name}.files.license' ;\
|
||||
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\\\
|
||||
-v "buildroot=%%{buildroot}"\\\
|
||||
-v "ocaml_standard_library=%%{ocaml_standard_library}"\\\
|
||||
@ -528,9 +558,8 @@ ocaml setup.ml -configure \\\
|
||||
#
|
||||
_EOF_
|
||||
|
||||
%files
|
||||
%files -f files.fileattrs
|
||||
%defattr(-,root,root,-)
|
||||
%{_rpmmacrodir}/*
|
||||
%{_rpmconfigdir}/fileattrs
|
||||
%attr(755,root,root) %{_rpmconfigdir}/*.sh
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user