ba877b8
%global debug_package %{nil}
ba877b8
ba877b8
Name:           m1n1
Hector Martin fb67c62
Version:        1.4.11
ba877b8
Release:        %autorelease
ba877b8
Summary:        Bootloader and experimentation playground for Apple Silicon
ba877b8
ba877b8
# m1n1 proper is MIT licensed, but it relies on a number of vendored projects
ba877b8
# See the "License" section in README.md for the breakdown
041e273
License:        MIT AND CC0-1.0 AND OFL-1.1-RFN AND Zlib AND (BSD-2-Clause OR GPL-2.0-or-later) AND (BSD-3-Clause OR GPL-2.0-or-later)
ba877b8
URL:            https://github.com/AsahiLinux/m1n1
157df64
Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
ba877b8
ba877b8
%ifarch aarch64
ba877b8
# On aarch64 do a native build
ba877b8
BuildRequires:  gcc
ba877b8
%global buildflags RELEASE=1 ARCH=
ba877b8
%else
ba877b8
# By default m1n1 does a cross build
ba877b8
BuildRequires:  gcc-aarch64-linux-gnu
ba877b8
%global buildflags RELEASE=1
ba877b8
%endif
ba877b8
BuildRequires:  make
ba877b8
ba877b8
# For the bootloader logos and the framebuffer console
ba877b8
BuildRequires:  adobe-source-code-pro-fonts
ef0b7f3
BuildRequires:  coreutils
ef0b7f3
BuildRequires:  fontconfig
ba877b8
BuildRequires:  system-logos
ba877b8
BuildRequires:  ImageMagick
ba877b8
BuildRequires:  zopfli
ba877b8
157df64
# For the udev rule
157df64
BuildRequires:  systemd-rpm-macros
157df64
ba877b8
# These are bundled, modified and statically linked into m1n1
ba877b8
Provides:       bundled(arm-trusted-firmware)
ba877b8
Provides:       bundled(dwc3)
ba877b8
Provides:       bundled(dlmalloc)
ba877b8
Provides:       bundled(PDCLib)
ba877b8
Provides:       bundled(libfdt)
ba877b8
Provides:       bundled(minilzlib)
ba877b8
Provides:       bundled(tinf)
ba877b8
ba877b8
%description
ba877b8
m1n1 is the bootloader developed by the Asahi Linux project to bridge the Apple
ba877b8
(XNU) boot ecosystem to the Linux boot ecosystem.
ba877b8
ba877b8
%package        tools
ba877b8
Summary:        Developer tools for m1n1
ba877b8
Requires:       %{name} = %{version}-%{release}
ba877b8
Requires:       python3
ba877b8
Requires:       python3dist(construct)
ba877b8
Requires:       python3dist(pyserial)
157df64
Requires:       systemd-udev
ba877b8
BuildArch:      noarch
ba877b8
ba877b8
%description    tools
ba877b8
This package contains various developer tools for m1n1.
ba877b8
ba877b8
%prep
ba877b8
%autosetup -p1
ba877b8
ba877b8
# Use our logos
ba877b8
# https://pagure.io/fedora-logos/pull-request/21
ba877b8
# https://pagure.io/generic-logos/pull-request/2
157df64
pushd data
157df64
rm bootlogo_{128,256}.{bin,png}
ba877b8
convert -background none -resize 128x128 -gravity center -extent 128x128 \
157df64
  %{_datadir}/pixmaps/fedora-logo-sprite.svg bootlogo_128.png
157df64
zopflipng -ym bootlogo_128.png bootlogo_128.png
ba877b8
convert -background none -resize 256x256 -gravity center -extent 256x256 \
157df64
  %{_datadir}/pixmaps/fedora-logo-sprite.svg bootlogo_256.png
157df64
zopflipng -ym bootlogo_256.png bootlogo_256.png
157df64
./makelogo.sh
157df64
popd
ba877b8
ba877b8
# Use our fonts
e442445
font="$(fc-match "Source Code Pro:bold" 'file' | cut -d= -f2)"
e442445
if [ ! -e "$font" ]; then
e442445
    echo "Failed to find font"
e442445
    exit 1
e442445
fi
e442445
ba877b8
pushd font
ba877b8
rm SourceCodePro-Bold.ttf font.bin font_retina.bin
ba877b8
./makefont.sh 8 16 12 "$font" font.bin
ba877b8
./makefont.sh 16 32 25 "$font" font_retina.bin
ba877b8
popd
ba877b8
ba877b8
%build
ba877b8
%make_build %{buildflags}
ba877b8
ba877b8
%install
ba877b8
install -Dpm0644 -t %{buildroot}%{_libdir}/%{name} build/%{name}.{bin,macho}
ba877b8
install -Ddpm0755 %{buildroot}%{_libexecdir}/%{name}
ba877b8
cp -pr proxyclient tools %{buildroot}%{_libexecdir}/%{name}/
157df64
install -Dpm0644 -t %{buildroot}%{_udevrulesdir} udev/80-m1n1.rules
ba877b8
ba877b8
%files
ba877b8
%license LICENSE 3rdparty_licenses/LICENSE.*
ba877b8
%doc README.md
ba877b8
%{_libdir}/%{name}
ba877b8
ba877b8
%files tools
ba877b8
%{_libexecdir}/%{name}
157df64
%{_udevrulesdir}/80-m1n1.rules
ba877b8
ba877b8
%changelog
ba877b8
%autochangelog