# Keep in sync "0/with" "1/without" %if 0%{?fedora} > 34 || 0%{?rhel} > 9 %bcond slowtests 1 %else %bcond_without slowtests %endif %undefine _missing_build_ids_terminate_build %global srcver 0.24.2 %global srcpre rc2 %global pkgsrc %{srcver}%{?srcpre:-%{srcpre}} # TODO: Architectures will be provided by the hare macros package %global hare_arches x86_64 aarch64 riscv64 %global _description %{expand: Hare is a systems programming language designed to be simple, stable, and robust. Hare uses a static type system, manual memory management, and a minimal runtime. It is well-suited to writing operating systems, system tools, compilers, networking software, and other low-level, high performance tasks.} Name: hare Version: %{srcver}%{?srcpre:~%{srcpre}} Release: %autorelease Summary: Hare language development tools License: GPL-3.0-only URL: https://git.sr.ht/~sircmpwn/hare Source0: %{url}/archive/%{pkgsrc}.tar.gz ExclusiveArch: %{hare_arches} BuildRequires: harec BuildRequires: make BuildRequires: qbe BuildRequires: scdoc BuildRequires: tzdata Provides: hare-compiler Requires: binutils Requires: harec Requires: tzdata Requires: %{name}-filesystem Recommends: %{name}-stdlib = %{version}-%{release} %description %{_description} # TODO: Filesystem subpackage will be moved to the hare macros package %package filesystem Summary: Directories used by Hare packages License: LicenseRef-Fedora-Public-Domain BuildArch: noarch %description filesystem The basic system directory layout used by Hare source packages. %package stdlib Summary: The Hare standard library License: MPL-2.0 BuildArch: noarch Requires: hare-compiler Suggests: hare = %{version}-%{release} %description stdlib %{_description} %package xgnu Summary: GNU tools for cross-compiling Hare programs BuildArch: noarch Requires: hare-compiler Suggests: hare = %{version}-%{release} %ifnarch x86_64 Requires: gcc-x86_64-linux-gnu Requires: binutils-x86_64-linux-gnu %endif %ifnarch aarch64 Requires: gcc-aarch64-linux-gnu Requires: binutils-aarch64-linux-gnu %endif %ifnarch riscv64 Requires: gcc-riscv64-linux-gnu Requires: binutils-riscv64-linux-gnu %endif %description xgnu %{_description} %package xllvm Summary: LLVM tools for cross-compiling Hare programs BuildArch: noarch Requires: clang Requires: lld Requires: llvm Requires: hare-compiler Suggests: hare = %{version}-%{release} %description xllvm %{_description} %prep %autosetup -n %{name}-%{pkgsrc} %build # Adjust configuration cp configs/linux.mk config.mk sed -i 's|^PREFIX.*|PREFIX = %{_prefix}|' config.mk sed -i 's|^ARCH.*|ARCH = %{_arch}|' config.mk sed -i 's|^VERSION.*|VERSION = %{version}|' config.mk # Clear set cross compile options sed -i -E '/^.*_(AS|CC|LD).*/d' config.mk sed -i -z 's/\n\n\n/\n/' config.mk echo "# Cross compiling options" >> config.mk # Default cross compile toolchain is GNU for arch in %{hare_arches} do ARCH="%{_arch}" if [[ "${ARCH}" = "${arch}" ]] then echo "${RPM_ARCH^^}_AS = as" >> config.mk echo "${RPM_ARCH^^}_CC = gcc" >> config.mk echo "${RPM_ARCH^^}_LD = ld" >> config.mk else ARCH="${arch}" echo "${ARCH^^}_AS = ${arch}-linux-gnu-as" >> config.mk echo "${ARCH^^}_CC = ${arch}-linux-gnu-gcc" >> config.mk echo "${ARCH^^}_LD = ${arch}-linux-gnu-ld" >> config.mk fi echo "" >> config.mk done %{!?_auto_set_build_flags:%{set_build_flags}} %make_build %install %make_install mkdir -m 0755 %{buildroot}%{_usrsrc}/hare/third-party %check %{?with_slowtests:HARETEST_INCLUDE="slow"} make check %files %license cmd/COPYING %doc MAINTAINERS README README.md TREES docs/*.md docs/*.txt %{_bindir}/hare %{_bindir}/haredoc %{_mandir}/man1/hare* %{_mandir}/man5/hare* %files filesystem %dir %{_usrsrc}/hare %dir %{_usrsrc}/hare/third-party %files stdlib %license COPYING %doc MAINTAINERS README README.md TREES docs/*.md docs/*.txt %dir %{_usrsrc}/hare/stdlib %{_usrsrc}/hare/stdlib/* %files xgnu %files xllvm %changelog %autochangelog