forked from pool/ocaml-rpm-macros
Accepting request 887313 from devel:languages:ocaml
- Remove ocaml_native_compiler flag, assume native target This flag puts too much burden on pkgs that use ocaml, but build with their buildsystem instead of using dune - Use bcond suse_ocaml_use_rpm_license_macro for license in filelist - Add suse prefix to ocaml_native_compiler to avoid conflict - Create Provides/Requires only for rpm variants which understand fileattrs - Fix syntax for chmod of .cmxs - Add conditional to disable debug_package macro when building with broken rpm variants OBS-URL: https://build.opensuse.org/request/show/887313 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ocaml-rpm-macros?expand=0&rev=13
This commit is contained in:
commit
9f61a9726f
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 21 12:34:56 UTC 2021 - ohering@suse.de
|
||||
|
||||
- Remove ocaml_native_compiler flag, assume native target
|
||||
This flag puts too much burden on pkgs that use ocaml, but build
|
||||
with their buildsystem instead of using dune
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 9 09:09:09 UTC 2021 - ohering@suse.de
|
||||
|
||||
- Use bcond suse_ocaml_use_rpm_license_macro for license in filelist
|
||||
- Add suse prefix to ocaml_native_compiler to avoid conflict
|
||||
- Create Provides/Requires only for rpm variants which understand fileattrs
|
||||
- Fix syntax for chmod of .cmxs
|
||||
- Add conditional to disable debug_package macro when building with broken rpm variants
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 9 09:09:09 UTC 2021 - ohering@suse.de
|
||||
|
||||
|
@ -17,38 +17,31 @@
|
||||
|
||||
|
||||
Name: ocaml-rpm-macros
|
||||
Version: 20210209
|
||||
Version: 20210421
|
||||
Release: 0
|
||||
Summary: RPM macros for building OCaml source packages
|
||||
License: GPL-2.0-only
|
||||
Group: Development/Languages/OCaml
|
||||
BuildRoot: %_tmppath/%name-%version-build
|
||||
ExclusiveArch: %arm aarch64 %ix86 ppc ppc64 ppc64le riscv64 s390x x86_64
|
||||
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:
|
||||
#Macros:
|
||||
#_with_ocaml_force_enable_ocaml_opt 1
|
||||
#_with_ocaml_force_disable_ocaml_opt 1
|
||||
#_with_ocaml_make_testsuite 1
|
||||
#:Macros
|
||||
%bcond_with ocaml_force_enable_ocaml_opt
|
||||
%bcond_with ocaml_force_disable_ocaml_opt
|
||||
%bcond_with ocaml_make_testsuite
|
||||
%if %{with ocaml_force_enable_ocaml_opt}
|
||||
%define do_opt 1
|
||||
%endif
|
||||
%if %{without ocaml_force_enable_ocaml_opt}
|
||||
%ifarch %{arm} aarch64 %{ix86} ppc ppc64 ppc64le riscv64 s390x x86_64
|
||||
%define do_opt 1
|
||||
%endif
|
||||
%endif
|
||||
#
|
||||
%if %{with ocaml_force_disable_ocaml_opt}
|
||||
%define do_opt 0
|
||||
%endif
|
||||
#
|
||||
|
||||
%description
|
||||
@ -63,30 +56,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,20 +116,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 %{do_opt}
|
||||
%%ocaml_preserve_bytecode \
|
||||
%%define _lto_cflags %%{nil} \
|
||||
%%{nil}
|
||||
%%ocaml_native_compiler 1
|
||||
%%_find_debuginfo_dwz_opts %%{nil}
|
||||
%else
|
||||
%%ocaml_preserve_bytecode \
|
||||
%%undefine _build_create_debug \
|
||||
%%define __arch_install_post export NO_BRP_STRIP_DEBUG=true \
|
||||
%%define _lto_cflags %%{nil} \
|
||||
%%{nil}
|
||||
%%ocaml_native_compiler 0
|
||||
%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
|
||||
%%ocaml_preserve_bytecode \
|
||||
%if %{without suse_ocaml_opt_debug_package}
|
||||
%%define debug_package %%{nil} \
|
||||
%%define __debug_install_post %%{nil} \
|
||||
%endif
|
||||
%%define _lto_cflags %%{nil} \
|
||||
%%{nil}
|
||||
%%_find_debuginfo_dwz_opts %%{nil}
|
||||
|
||||
# Create file list for base pkg and base-devel pkg
|
||||
# Files with known extensions or names are written to 'files' or 'files.devel'
|
||||
@ -157,14 +162,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 +533,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