File hardened_malloc.spec of Package hardened_malloc

Name:           hardened_malloc
Version:        13
Release:        1%{?dist}
Summary:        Hardened allocator designed for modern systems

License:        MIT
URL:            https://github.com/GrapheneOS/hardened_malloc
Source0:        hardened_malloc-%{version}.tar.gz
BuildRequires:  gcc gcc-c++ make python3
ExclusiveArch:  x86_64 aarch64

%define debug_package %{nil}

%description
Hardened allocator designed for modern systems.

It has integration into Android's Bionic libc and can be used externally with
musl and glibc as a dynamic library for use on other Linux-based platforms. It
will gain more portability / integration over time.

%prep
%autosetup

%build
# https://github.com/GrapheneOS/hardened_malloc/issues/200
# https://github.com/GrapheneOS/hardened_malloc/pull/253
export CFLAGS="%{optflags} -Wno-error=unterminated-string-initialization"
export CXXFLAGS="%{optflags} -Wno-error=unterminated-string-initialization"

cp config/default.mk config/pkey.mk
sed -i 's/CONFIG_SEAL_METADATA := false/CONFIG_SEAL_METADATA := true/' config/pkey.mk

make CONFIG_NATIVE=false VARIANT=default
make CONFIG_NATIVE=false VARIANT=light
make CONFIG_NATIVE=false VARIANT=pkey

%install
install -Dm0755 -s out/libhardened_malloc.so %{buildroot}%{_libdir}/libhardened_malloc.so;
install -Dm0755 -s out-light/libhardened_malloc-light.so %{buildroot}%{_libdir}/libhardened_malloc-light.so;
install -Dm0755 -s out-pkey/libhardened_malloc-pkey.so %{buildroot}%{_libdir}/libhardened_malloc-pkey.so;

%check
make test

%files
%license LICENSE CREDITS
%doc README.md
%{_libdir}/libhardened_malloc.so
%{_libdir}/libhardened_malloc-light.so
%{_libdir}/libhardened_malloc-pkey.so

%changelog
* Wed Dec 10 2025 Napiany - 13-1
- Initial hardened_malloc spec
openSUSE Build Service is sponsored by