jart / cosmopolitan

build-once run-anywhere c library
ISC License
18.31k stars 628 forks source link

Creating an RPM package of cosmocc #1097

Closed tecosaur closed 9 months ago

tecosaur commented 9 months ago

While the cosmocc zip is easy to grab and use, I do like avoiding non-packaged applications on my computer. So, I've turned the zip into an RPM package for OpenSUSE Tumbleweed: https://build.opensuse.org/package/show/home:tecosaur/cosmocc

In case this is of interest, or should there be any comments about this, I thought I'd mention it here :slightly_smiling_face:.

For reference, this is the current specfile:

Name:           cosmocc
Version:        3.2.4
Release:        0
Summary:        Your build-anywhere run-anywhere c library
License:        ISC
Group:          Development/Languages/C and C++
URL:            https://justine.lol/cosmopolitan/index.html
BuildRequires:  unzip
BuildRequires:  fdupes
Source0:        https://cosmo.zip/pub/cosmocc/%{name}-%{version}.zip
Source1:        %{name}.rpmlintrc
BuildArch:      noarch

%description
Cosmopolitan Libc makes C a build-anywhere run-anywhere language, like Java,
except it doesn't need an interpreter or virtual machine. Instead, it
reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that
runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS on
AMD64 and ARM64 with the best possible performance.

%prep
%build
%install

mkdir -p %{buildroot}/opt
unzip %{SOURCE0} -d %{buildroot}/opt/cosmocc
%fdupes %{buildroot}/opt/cosmocc
# We could create symlinks, but this causses issues with the usage of $0 in the
# cosmocc/bin scripts which don't use realpath.
mkdir -p %{buildroot}%{_bindir}
for exec in "cosmoar" "cosmocc" "cosmoc++" \
    "x86_64-unknown-cosmo-cc" "x86_64-unknown-cosmo-c++" \
    "aarch64-unknown-cosmo-cc" "aarch64-unknown-cosmo-c++" \
    "unknown-unknown-cosmo-cc" "unknown-unknown-cosmo-c++"; do
    printf '#!/bin/sh\nexec /opt/cosmocc/bin/%s "$@"\n' "$exec" > %{buildroot}%{_bindir}/"$exec"
    chmod +x %{buildroot}%{_bindir}/"$exec"
done

%files
/opt/cosmocc
%{_bindir}/*
jart commented 9 months ago

Thanks for bringing it to our attention. Could you edit our Wiki please to include this information? Thanks!

jart commented 9 months ago

https://github.com/jart/cosmopolitan/wiki should be publicly editable