chore: backport the nim fixes from #2955

This commit is contained in:
madonuko
2025-01-15 00:45:17 +08:00
parent 8d93c6975c
commit d397a81fa5
2 changed files with 26 additions and 17 deletions
+8 -4
View File
@@ -1,13 +1,13 @@
%global csrc_commit 561b417c65791cd8356b5f73620914ceff845d10
%global commit 21771765a2c1f1fc86d87ad6e032d4050d8a651b
%global commit 7dfadb8b4e95d09981fbeb01d85b12f23946c3e7
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global ver 2.1.99
%global commit_date 20240910
%global ver 2.2.1
%global commit_date 20241004
%global debug_package %nil
Name: nim-nightly
Version: %ver^%commit_date.%shortcommit
Release: 1%?dist
Release: 3%?dist
Summary: Imperative, multi-paradigm, compiled programming language
License: MIT and BSD
URL: https://nim-lang.org
@@ -124,6 +124,10 @@ ln -s %_prefix/lib/nim %buildroot%_prefix/lib/nim/lib || true
rm -rf %buildroot/nim || true
rm %buildroot%_bindir/*.bat || true
cp -r dist %buildroot%_prefix/lib/nim/
# cannot use `ln` here, possibly a nim bug
cp -r %buildroot%_prefix/lib/nim/dist %buildroot%_datadir/nim/
%files
%license copying.txt dist/nimble/license.txt
+18 -13
View File
@@ -2,8 +2,8 @@
%global debug_package %{nil}
Name: nim
Version: 2.0.8
Release: 1%?dist
Version: 2.2.0
Release: 3%?dist
Summary: Imperative, multi-paradigm, compiled programming language
License: MIT and BSD
URL: https://nim-lang.org
@@ -12,7 +12,7 @@ Source2: nimgrep.1
Source3: nimble.1
Source4: nimsuggest.1
BuildRequires: gcc mold git-core gcc-c++ nodejs openssl-devel pkgconfig(bash-completion) gc-devel pcre-devel
BuildRequires: redhat-rpm-config
BuildRequires: redhat-rpm-config anda-srpm-macros
Requires: gcc
@@ -46,18 +46,14 @@ and its standard library.
%prep
rm -rf ./*
# using git clone to include submodules
git clone --recurse-submodules -j8 https://github.com/nim-lang/Nim -b v%version --depth 1 .
# hack
cp /usr/bin/mold /usr/bin/ld
%git_clone https://github.com/nim-lang/Nim v%version
%build
export CFLAGS="${CFLAGS} -Ofast"
export CXXFLAGS="${CXXFLAGS} -Ofast"
export FFLAGS="${FFLAGS} -Ofast"
export FCFLAGS="${FCFLAGS} -Ofast"
export CFLAGS="${CFLAGS} -Ofast -fuse-ld=mold"
export CXXFLAGS="${CXXFLAGS} -Ofast -fuse-ld=mold"
export FFLAGS="${FFLAGS} -Ofast -fuse-ld=mold"
export FCFLAGS="${FCFLAGS} -Ofast -fuse-ld=mold"
export PATH="$(pwd):$(pwd)/bin:${PATH}"
@@ -81,6 +77,11 @@ sed -i '/<link.*fonts.googleapis.com/d' doc/html/*.html
%install
export CFLAGS="${CFLAGS} -Ofast -fuse-ld=mold"
export CXXFLAGS="${CXXFLAGS} -Ofast -fuse-ld=mold"
export FFLAGS="${FFLAGS} -Ofast -fuse-ld=mold"
export FCFLAGS="${FCFLAGS} -Ofast -fuse-ld=mold"
export PATH="$(pwd):$(pwd)/bin:${PATH}"
# --main:compiler/nim.nim
@@ -113,11 +114,15 @@ install -Dm755 bin/* -t %buildroot%_bindir
install -d %buildroot%_includedir
cp -a %buildroot%_prefix/lib/nim/lib/*.h %buildroot%_includedir
ln -s %_prefix/lib/nim %buildroot%_prefix/lib/nim/lib # compiler needs lib from here
ln -s %_prefix/lib/nim/system.nim %_prefix/lib/system.nim # nimsuggest bug
#ln -s %_prefix/lib/nim/system.nim %buildroot%_prefix/lib/system.nim # nimsuggest bug
rm -rf %buildroot/nim || true
rm %buildroot%_bindir/*.bat || true
rm -rf %buildroot%_bindir/empty.txt
cp -r dist %buildroot%_prefix/lib/nim/
# cannot use `ln` here, possibly a nim bug
cp -r %buildroot%_prefix/lib/nim/dist %buildroot%_datadir/nim/
%files
%license copying.txt dist/nimble/license.txt