File ghc-prepare-binary-distributions.spec of Package ghc-prepare-binary-distributions
#
# spec file for package ghc-prepare-binary-distributions
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global unregisterised_archs loongarch64
%ifarch aarch64
%define longarch aarch64
%endif
%ifarch ppc64
%define longarch powerpc64
%endif
%ifarch ppc64le
%define longarch powerpc64le
%endif
%ifarch riscv64
%define longarch riscv64
%endif
%ifarch s390
%define longarch s390
%endif
%ifarch s390x
%define longarch s390x
%endif
%ifarch x86_64
%define longarch x86_64
%endif
%ifarch s390 s390x
%define sysname ibm
%else
%define sysname unknown
%endif
%define system_libffi 1
Name: ghc-prepare-binary-distributions
Version: 9.10.1
Release: 0
Summary: The Glorious Glasgow Haskell Compiler binary distribution
License: BSD-3-Clause
URL: https://haskell.org/ghc
Source: http://haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.xz
#%%Source: ghc-%{version}-src.tar.xz
Source1: bootstrap-sources.tar.gz
Patch1: ghc-gen_contents_index-haddock-path.patch
# https://ghc.haskell.org/trac/ghc/ticket/15689
Patch2: ghc-Cabal-install-PATH-warning.patch
# PATCH-FIX-UPSTREAM Disable-unboxed-arrays.patch ptrommler@icloud.com -- Do not use unboxed arrays on big-endian platforms. See Haskell Trac #15411.
Patch3: Disable-unboxed-arrays.patch
Patch5: ppc64le-miscompilation.patch
Patch100: os-string-be.patch
Patch200: ghc-hadrian-s390x-rts--qg.patch
Patch300: hadrian-9.10-deps.patch
# Backport of MR 13105 (NCG for RISCV64)
Patch243: riscv64-ncg.patch
Patch400: gnu23-hp2ps.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: binutils
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gmp-devel
BuildRequires: ghc-bootstrap
BuildRequires: ghc-bootstrap-helpers
BuildRequires: libelf-devel
BuildRequires: libffi-devel
BuildRequires: lzip
BuildRequires: make
# for terminfo
# for terminfo
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: python3
# ignore failures with unregisterised compilers (s390x)
#!BuildIgnore: post-build-checks
ExcludeArch: %{arm} %{ix86}
%ifarch !loongarch64
BuildRequires: llvm15-devel
BuildRequires: llvm15
BuildRequires: clang15
%endif
%ifarch s390x
%define hadrian_llvm +llvm
%endif
BuildRequires: memory-constraints
%description
Haskell is the standard purely functional programming language; the
current language version is Haskell 98, agreed in December 1998.
GHC is a state-of-the-art programming suite for Haskell. Included is
an optimising compiler generating good code for a variety of
platforms, together with an interactive system for convenient, quick
development. The distribution includes space and time profiling
facilities, a large collection of libraries, and support for various
language extensions, including concurrency, exceptions, and foreign
language interfaces (C, C++, etc).
A wide variety of Haskell related resources (tutorials, libraries,
specifications, documentation, compilers, interprbeters, references,
contact information, links to research groups) are available from the
Haskell home page at <http://www.haskell.org/>.
%prep
%setup -q -n ghc-%{version}
# workaround bogus gcc warning that causes unregistered builds to be rejected
# by OBS - rpmlint filters do not work with OBS checks
#sed -i -e '/SRC_CC_OPTS/s/$/ -Wno-return-type/' mk/warnings.mk
rm libffi-tarballs/libffi-*.tar.gz
%patch -P 1 -p1
%patch -P 2 -p1
%ifarch s390x
%patch -P 3 -p1
%endif
%patch -P 5 -p1
%patch -P 100 -p1
%ifarch loongarch64 ppc64le s390x riscv64
%patch -P 200 -p1
%endif
%patch -P 300 -p1
%patch -P 400 -p1
%patch -P 243 -p1
%build
export PATH="$PATH:/opt/bin"
autoupdate
python3 boot.source --hadrian
%if 0%{?qemu_user_space_build}
%limit_build -m 15000
%endif
cp %{SOURCE1} ./
hadrian/bootstrap/bootstrap.py --bootstrap-sources bootstrap-sources.tar.gz
%global hadrian _build/bin/hadrian
# macro ...
#%%{ghc_set_gcc_flags}
export LANG=C.utf8
export CFLAGS="${CFLAGS:-%{optflags}}"
# FIXME: you should use the %%configure macro
./configure --with-system-libffi --disable-system-ld-override\
%ifarch %{ghc_unregisterized_arches}
--enable-unregisterised \
%endif
%{nil}
%{hadrian} --docs=none --flavour=quick%{?hadrian_llvm} binary-dist-xz
%install
mkdir -p %{buildroot}%{_datadir}/ghc
cp _build/bindist/ghc-%{version}-%{longarch}-%{sysname}-linux.tar.xz %{buildroot}%{_datadir}/ghc
%check
%files
%dir %{_datadir}/ghc
%{_datadir}/ghc/ghc-%{version}-%{longarch}-%{sysname}-linux.tar.xz
%changelog