mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 09:01:55 +00:00
(cherry picked from commit f179d855bf)
Co-authored-by: madomado <madonuko@outlook.com>
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
Name: anda-srpm-macros
|
||||
Version: 0.1.7
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: SRPM macros for extra Fedora packages
|
||||
|
||||
License: MIT
|
||||
# URL:
|
||||
Source0: macros.cargo_extra
|
||||
Source1: macros.caching
|
||||
Source2: macros.anda
|
||||
Source3: macros.go_extra
|
||||
Source4: macros.nim_extra
|
||||
URL: https://github.com/terrapkg/srpm-macros
|
||||
Source0: %url/archive/refs/tags/v%{version}.tar.gz
|
||||
|
||||
Recommends: rust-packaging
|
||||
Requires: git-core
|
||||
@@ -21,25 +17,27 @@ BuildArch: noarch
|
||||
%{summary}
|
||||
|
||||
%prep
|
||||
%autosetup -n srpm-macros-%version
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} %{SOURCE0}
|
||||
install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} %{SOURCE1}
|
||||
install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} %{SOURCE2}
|
||||
install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} %{SOURCE3}
|
||||
install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} %{SOURCE4}
|
||||
for file in ./macros.*; do
|
||||
install -Dpm644 -t %buildroot%_rpmmacrodir $file
|
||||
done
|
||||
|
||||
%files
|
||||
%{_rpmmacrodir}/macros.cargo_extra
|
||||
%{_rpmmacrodir}/macros.caching
|
||||
%{_rpmmacrodir}/macros.anda
|
||||
%{_rpmmacrodir}/macros.caching
|
||||
%{_rpmmacrodir}/macros.cargo_extra
|
||||
%{_rpmmacrodir}/macros.go_extra
|
||||
%{_rpmmacrodir}/macros.nim_extra
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Aug 14 2024 madonuko <mado@fyralabs.com> - 0.1.7-2
|
||||
- Move sources outside of packages repo
|
||||
|
||||
* Wed Mar 13 2024 madonuko <mado@fyralabs.com> - 0.1.6-1
|
||||
- Add nim_c, nim_tflags and nim_lflags
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
%git_clone(Rc) %{lua:
|
||||
local dir = rpm.expand("%{_builddir}/%{name}-%{version}")
|
||||
-- if dir exists, remove it
|
||||
os.execute("rm -rf " .. dir)
|
||||
os.execute(rpm.expand("%{__git} clone %{-R:--recursive} %{1} " .. dir))
|
||||
posix.chdir(dir)
|
||||
if rpm.expand("-c") ~= "" then
|
||||
os.execute(rpm.expand("%{__git} checkout %{2}"))
|
||||
end
|
||||
|
||||
-- tarball the folder
|
||||
local tarball = rpm.expand("%{_sourcedir}/%{name}-%{version}.tar.gz")
|
||||
os.execute("tar -C ".. dir .. "/../ " .. " -czvf " .. tarball .. " " .. rpm.expand("%{name}-%{version}"))
|
||||
|
||||
|
||||
print(rpm.expand("%{name}-%{version}.tar.gz"))
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
|
||||
|
||||
%_sccache %{_bindir}/sccache
|
||||
|
||||
%sccache_prep (\
|
||||
export CC="%{_sccache} $CC" \
|
||||
export CXX="%{_sccache} $CXX" \
|
||||
export RUSTC_WRAPPER="sccache" \
|
||||
\
|
||||
export SCCACHE_BUCKET=%{?sccache_bucket}\
|
||||
export SCCACHE_ENDPOINT=%{?sccache_endpoint}\
|
||||
export AWS_SECRET_ACCESS_KEY=%{?sccache_secret}\
|
||||
export AWS_ACCESS_KEY_ID=%{?sccache_accesskey}\
|
||||
export SCCACHE_S3_USE_SSL=true\
|
||||
)
|
||||
|
||||
%cargo_prep_online_sccache (\
|
||||
set -eu \
|
||||
%{__mkdir} -p .cargo \
|
||||
cat > .cargo/config << EOF \
|
||||
[build]\
|
||||
rustc = "%{__rustc}"\
|
||||
rustc-wrapper = "%{_sccache}"\
|
||||
rustdoc = "%{__rustdoc}"\
|
||||
\
|
||||
[env]\
|
||||
CFLAGS = "%{build_cflags}"\
|
||||
CXXFLAGS = "%{build_cxxflags}"\
|
||||
LDFLAGS = "%{build_ldflags}"\
|
||||
\
|
||||
[install]\
|
||||
root = "%{buildroot}%{_prefix}"\
|
||||
\
|
||||
[term]\
|
||||
verbose = true\
|
||||
\
|
||||
[source]\
|
||||
\
|
||||
[source.local-registry]\
|
||||
directory = "%{cargo_registry}"\
|
||||
\
|
||||
EOF\
|
||||
%{__rm} -f Cargo.lock \
|
||||
%{__rm} -f Cargo.toml.orig \
|
||||
)
|
||||
@@ -1,115 +0,0 @@
|
||||
%cargo_prep_online (\
|
||||
set -eu \
|
||||
%{__mkdir} -p .cargo \
|
||||
cat > .cargo/config << EOF \
|
||||
[profile.rpm]\
|
||||
inherits = "release"\
|
||||
opt-level = 3\
|
||||
codegen-units = 1\
|
||||
debug = 2\
|
||||
strip = "none"\
|
||||
\
|
||||
[build]\
|
||||
rustc = "%{__rustc}"\
|
||||
rustdoc = "%{__rustdoc}"\
|
||||
\
|
||||
[env]\
|
||||
CFLAGS = "%{build_cflags}"\
|
||||
CXXFLAGS = "%{build_cxxflags}"\
|
||||
LDFLAGS = "%{build_ldflags}"\
|
||||
\
|
||||
[install]\
|
||||
root = "%{buildroot}%{_prefix}"\
|
||||
\
|
||||
[term]\
|
||||
verbose = true\
|
||||
\
|
||||
[source]\
|
||||
\
|
||||
[source.local-registry]\
|
||||
directory = "%{cargo_registry}"\
|
||||
\
|
||||
EOF\
|
||||
%{__rm} -f Cargo.toml.orig \
|
||||
)
|
||||
|
||||
|
||||
|
||||
# cargo_license: print license information for all crate dependencies
|
||||
#
|
||||
# The "no-build,no-dev,no-proc-macro" argument results in only crates which are
|
||||
# linked into the final binary to be considered.
|
||||
#
|
||||
# Additionally, deprecated SPDX syntax ("/" instead of "OR") is normalized
|
||||
# before sorting the results to ensure reproducible output of this macro.
|
||||
#
|
||||
# This macro must be called with the same feature flags as other cargo macros,
|
||||
# in particular, "cargo_build", otherwise its output will be incomplete.
|
||||
#
|
||||
# The "cargo tree" command called by this macro will fail if there are missing
|
||||
# (optional) dependencies.
|
||||
%cargo_license_online(naf:)\
|
||||
(\
|
||||
set -euo pipefail\
|
||||
%{shrink: \
|
||||
%{__cargo} tree \
|
||||
-Z avoid-dev-deps \
|
||||
--workspace \
|
||||
--edges no-build,no-dev,no-proc-macro \
|
||||
--no-dedupe \
|
||||
--target all \
|
||||
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
||||
--prefix none \
|
||||
--format "{l}: {p}" \
|
||||
| sed -e "s: ($(pwd)[^)]*)::g" -e "s: / :/:g" -e "s:/: OR :g" \
|
||||
| sort -u \
|
||||
}\
|
||||
)
|
||||
|
||||
# cargo_license_summary: print license summary for all crate dependencies
|
||||
#
|
||||
# This macro works in the same way as cargo_license, except that it only prints
|
||||
# a list of licenses, and not the complete license information for every crate
|
||||
# in the dependency tree. This is useful for determining the correct License
|
||||
# tag for packages that contain compiled Rust binaries.
|
||||
%cargo_license_summary_online(naf:)\
|
||||
(\
|
||||
set -euo pipefail\
|
||||
%{shrink: \
|
||||
%{__cargo} tree \
|
||||
-Z avoid-dev-deps \
|
||||
--workspace \
|
||||
--edges no-build,no-dev,no-proc-macro \
|
||||
--no-dedupe \
|
||||
--target all \
|
||||
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
||||
--prefix none \
|
||||
--format "# {l}" \
|
||||
| sed -e "s: / :/:g" -e "s:/: OR :g" \
|
||||
| sort -u \
|
||||
}\
|
||||
)
|
||||
|
||||
# cargo_vendor_manifest: write list of vendored crates and their versions
|
||||
#
|
||||
# The arguments for the internal "cargo tree" call emulate the logic
|
||||
# that determines which crates are included when running "cargo vendor".
|
||||
# The results are written to "cargo-vendor.txt".
|
||||
%cargo_vendor_manifest_online()\
|
||||
(\
|
||||
set -euo pipefail\
|
||||
%{shrink: \
|
||||
%{__cargo} tree \
|
||||
--workspace \
|
||||
--edges normal,build,dev \
|
||||
--no-dedupe \
|
||||
--target all \
|
||||
--all-features \
|
||||
--prefix none \
|
||||
--format "{p}" \
|
||||
| grep -v "$(pwd)" \
|
||||
| sed -e "s: (proc-macro)::" \
|
||||
| sort -u \
|
||||
> cargo-vendor.txt \
|
||||
}\
|
||||
)
|
||||
@@ -1,6 +0,0 @@
|
||||
%go_prep_online() (cd %{?1}%{!?1:.} && go mod download)
|
||||
|
||||
%go_build_online() mkdir -p build/bin && \
|
||||
go build -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -s -w" -buildmode=pie \
|
||||
-o %{?2}%{!?2:build/bin/%{?1}%{!?1:%name}} \
|
||||
%{?1}%{!?1:.}
|
||||
@@ -1,5 +0,0 @@
|
||||
%nim_tflags %(echo "%?build_cflags -fPIE" | sed "s/-O2/-Ofast/g" | sed "s/-Wall//g")
|
||||
|
||||
%nim_lflags %?build_ldflags -pie
|
||||
|
||||
%nim_c -d:release -t:"%nim_tflags" -l:"%nim_lflags"
|
||||
@@ -0,0 +1 @@
|
||||
rpm.version(gh("terrapkg/srpm-macros"));
|
||||
Reference in New Issue
Block a user