Add loongarch64 and sw_64 support

Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn>
(cherry picked from commit 4b4d4fd2acd8df6577c5a6424ddf18ed98078599)
This commit is contained in:
yangchenguang 2023-08-12 15:21:23 +08:00 committed by openeuler-sync-bot
parent 4e8ac26e99
commit 66c3721810
2 changed files with 1972 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,18 @@
%ifnarch loongarch64 sw_64
%global native_compiler 1
%else
%global native_compiler 0
%endif
%ifnarch loongarch64 sw_64
%global natdynlink 1
%else
%global natdynlink 0
%endif
Name: ocaml
Version: 4.13.1
Release: 6
Release: 7
Summary: OCaml compiler and programming environment
License: LGPL-2.1-only
URL: http://www.ocaml.org
@ -13,6 +25,8 @@ Patch0004: 0004-Update-dependencies.patch
Patch0005: 0005-Bug-fix-equal_private-was-being-used-in-too-many-pla.patch
Patch0006: 0006-asmcomp-dune-fix-build-on-RISC-V.patch
Patch3000: Add-loongarch64-native-support.patch
BuildRequires: gcc binutils-devel ncurses-devel gdbm-devel gawk perl-interpreter
BuildRequires: util-linux chrpath autoconf annobin make
@ -28,6 +42,12 @@ Obsoletes: %{name}-ocamldoc
%global __ocaml_requires_opts -c -f '%{buildroot}%{_bindir}/ocamlrun %{buildroot}%{_bindir}/ocamlobjinfo.byte'
%global __ocaml_provides_opts -f '%{buildroot}%{_bindir}/ocamlrun %{buildroot}%{_bindir}/ocamlobjinfo.byte'
%ifarch loongarch64
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}ocaml\\(Backend_intf\\)\.*
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}ocaml\\(Inlining_decision_intf\\)\.*
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}ocaml\\(Simplify_boxed_integer_ops_intf\\)\.*
%endif
%description
OCaml is a high-level, strongly-typed, functional and object-oriented
programming language from the ML family of languages. This package
@ -63,6 +83,10 @@ Help files for %{name}
%prep
%autosetup -n %{name}-%{version} -p1
autoconf --force
%ifarch loongarch64 sw_64
%_update_config_guess
%_update_config_sub
%endif
%build
@ -70,10 +94,15 @@ autoconf --force
OC_CFLAGS="$CFLAGS" \
OC_LDFLAGS="$LDFLAGS" \
--libdir=%{_libdir}/ocaml \
%ifarch sw_64
--enable-imprecise-c99-float-ops \
%endif
--host=`./build-aux/config.guess`
%make_build world
%if %{native_compiler}
%make_build opt
%make_build opt.opt
%endif
%check
cd testsuite
@ -123,6 +152,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
%{_bindir}/ocamlprof.byte
# native code versions
%if %{native_compiler}
%{_bindir}/ocamlc.opt
%{_bindir}/ocamlcp.opt
%{_bindir}/ocamldep.opt
@ -136,6 +166,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
%{_bindir}/ocamlopt
%{_bindir}/ocamlopt.byte
%{_bindir}/ocamlopt.opt
%endif
%{_libdir}/ocaml/camlheader
%{_libdir}/ocaml/camlheader_ur
@ -144,17 +175,24 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
%{_libdir}/ocaml/ld.conf
%{_libdir}/ocaml/Makefile.config
%{_libdir}/ocaml/*.a
%if %{natdynlink}
%{_libdir}/ocaml/*.cmxs
%endif
%if %{native_compiler}
%{_libdir}/ocaml/*.cmxa
%{_libdir}/ocaml/*.cmx
%{_libdir}/ocaml/*.o
%{_libdir}/ocaml/libasmrun_shared.so
%endif
%{_libdir}/ocaml/*.mli
%{_libdir}/ocaml/libcamlrun_shared.so
%{_libdir}/ocaml/threads/*.mli
%if %{native_compiler}
%{_libdir}/ocaml/threads/*.a
%{_libdir}/ocaml/threads/*.cmxa
%{_libdir}/ocaml/threads/*.cmx
%endif
%{_libdir}/ocaml/caml
#runtime
@ -191,10 +229,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
%{_libdir}/ocaml/compiler-libs/*.cmi
%{_libdir}/ocaml/compiler-libs/*.cmo
%{_libdir}/ocaml/compiler-libs/*.cma
%if %{native_compiler}
%{_libdir}/ocaml/compiler-libs/*.a
%{_libdir}/ocaml/compiler-libs/*.cmxa
%{_libdir}/ocaml/compiler-libs/*.cmx
%{_libdir}/ocaml/compiler-libs/*.o
%endif
%files help
@ -202,6 +242,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
%{_mandir}/man3/*
%changelog
* Sat Aug 12 2023 yangchenguang <yangchenguang@kylinsec.com.cn> - 4.13.1-7
- Add support for sw_64 and loongarch64
* Thu Jan 18 2023 xingxing <xingxing@xfusion.com> - 4.13.1-6
- fix build on RISC-V