chore: nim{,-nightly} don't build docs unless x86_64 (#988)

* chore: nim{,-nightly} don't build docs unless x86_64

* feat: add %nim_c, %nim_tflags and %nim_lflags
This commit is contained in:
madomado
2024-03-20 21:02:55 +08:00
committed by GitHub
parent 52b5fa3796
commit cbc958f17b
4 changed files with 60 additions and 34 deletions
+25 -11
View File
@@ -37,6 +37,7 @@ order of priority).
This package provides various tools, which help Nim programmers.
%ifarch x86_64
%package doc
Summary: Documentation for Nim programming language
BuildArch: noarch
@@ -47,12 +48,15 @@ order of priority).
This package provides documentation and reference manual for the language
and its standard library.
%endif
%prep
%autosetup -n Nim-%commit
# hack
cp /usr/bin/mold /usr/bin/ld
%build
export CFLAGS="${CFLAGS} -Ofast"
export CXXFLAGS="${CXXFLAGS} -Ofast"
@@ -67,13 +71,18 @@ nimBuildCsourcesIfNeeded CFLAGS="${CFLAGS} -Ic_code -w -O3 -fno-strict-aliasing
nim c --noNimblePath --skipUserCfg --skipParentCfg --hints:off -d:danger koch.nim
koch boot -d:release -d:nimStrictMode --lib:lib
%ifarch x86_64
koch docs &
%endif
(cd lib; nim c --app:lib -d:danger -d:createNimRtl -t:-fPIE -l:-pie nimrtl.nim) &
koch tools --skipUserCfg --skipParentCfg --hints:off -d:release -t:-fPIE -l:-pie &
nim c -d:danger -t:-fPIE -l:-pie nimsuggest/nimsuggest.nim &
wait
%ifarch x86_64
sed -i '/<link.*fonts.googleapis.com/d' doc/html/*.html
%endif
%install
export PATH="$(pwd):$(pwd)/bin:${PATH}"
@@ -83,24 +92,28 @@ mold -run bin/nim cc -d:nimCallDepthLimit=10000 -r tools/niminst/niminst --var:v
sh ./install.sh %buildroot/usr/bin
mkdir -p %buildroot/%_bindir %buildroot/%_datadir/bash-completion/completions
mkdir -p %buildroot/%_bindir %buildroot/%_datadir/bash-completion/completions %buildroot/usr/lib/nim
install -Dpm755 bin/nim{grep,suggest,pretty} %buildroot/%_bindir
install -Dpm644 tools/nim.bash-completion %buildroot/%_datadir/bash-completion/completions/nim
install -Dpm644 dist/nimble/nimble.bash-completion %buildroot/%_datadir/bash-completion/completions/nimble
install -Dpm644 -t%buildroot/%_mandir/man1 %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4
mkdir -p %buildroot/%_docdir/%name/html %buildroot/usr/lib/nim
%ifarch x86_64
mkdir -p %buildroot/%_docdir/%name/html
cp -a doc/html/*.html %buildroot/%_docdir/%name/html/
cp tools/dochack/dochack.js %buildroot/%_docdir/%name/
%endif
cp -r lib/* %buildroot%_prefix/lib/nim/
cp -a compiler %buildroot%_prefix/lib/nim/
install -Dm644 nim.nimble %buildroot%_prefix/lib/nim/compiler
install -Dm644 config/* -t %buildroot/etc/nim
install -d %buildroot%_includedir || true
cp -a %buildroot%_prefix/lib/nim/lib/*.h %buildroot%_includedir || true
ln -s %_prefix/lib/nim %buildroot%_prefix/lib/nim/lib || true
rm -rf %buildroot/nim || true
rm %buildroot%_bindir/*.bat || true
#check
# export PATH=$PATH:$(realpath ./bin)
# for cat in manyloc gc threads nimble-all lib io async rodfiles debugger examples dll flags
# do
# ./koch tests --pedantic category $cat -d:nimCoroutines || (echo "$cat test category failed" && exit 1)
# done
%files
%license copying.txt dist/nimble/license.txt
@@ -109,16 +122,17 @@ cp -r lib/* %buildroot%_prefix/lib/nim/
%_mandir/man1/nim{,ble}.1*
%_datadir/bash-completion/completions/nim{,ble}
%_prefix/lib/nim/
%_sysconfdir/nim/
%files tools
%license copying.txt
%_bindir/nim{grep,suggest,pretty}
%_mandir/man1/nim{grep,suggest}.1*
%ifarch x86_64
%files doc
%doc %_docdir/%name
%endif
%changelog
* Mon Jan 9 2023 windowsboy111 <windowsboy111@fyralabs.com> - 1.9.3^fcc383d89994241f1b73fe4f85ef38528c135e2e-1
- Initial Package.
%autochangelog
+23 -22
View File
@@ -3,7 +3,7 @@
Name: nim
Version: 2.0.2
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Imperative, multi-paradigm, compiled programming language
License: MIT and BSD
URL: https://nim-lang.org
@@ -13,8 +13,7 @@ Source2: nimgrep.1
Source3: nimble.1
Source4: nimsuggest.1
BuildRequires: gcc mold git gcc-c++ nodejs openssl-devel pkgconfig(bash-completion) gc-devel pcre-devel
Requires: redhat-rpm-config gcc
Conflicts: choosenim
Requires: gcc
%description
@@ -32,7 +31,7 @@ order of priority).
This package provides various tools, which help Nim programmers.
%ifarch x86_64
%package doc
Summary: Documentation for Nim programming language
BuildArch: noarch
@@ -43,10 +42,13 @@ order of priority).
This package provides documentation and reference manual for the language
and its standard library.
%endif
%prep
%autosetup -n nim-%{version}
%build
export CFLAGS="${CFLAGS} -Ofast"
export CXXFLAGS="${CXXFLAGS} -Ofast"
@@ -58,20 +60,24 @@ export PATH="$(pwd):$(pwd)/bin:${PATH}"
mold -run nim c -d:danger koch.nim
mold -run koch boot -d:useLinenoise -t:-fPIE -l:-pie -d:release -d:nativeStacktrace -d:useGnuReadline
%ifarch x86_64
mold -run koch docs &
%endif
(cd lib && nim c --app:lib -d:createNimRtl -d:release nimrtl.nim) &
mold -run koch tools -t:-fPIE -l:-pie &
mold -run nim c -t:-fPIE -l:-pie -d:release nimsuggest/nimsuggest.nim &
wait
%ifarch x86_64
sed -i '/<link.*fonts.googleapis.com/d' doc/html/*.html
%endif
%install
export PATH="$(pwd):$(pwd)/bin:${PATH}"
sh install.sh %{buildroot}usr/bin
mkdir -p %buildroot{%_bindir,%_docdir/%name/html,%_prefix/lib/nim}
mkdir -p %buildroot{%_bindir,%_prefix/lib/nim}
install -Dp -m755 bin/nim{,ble,grep,suggest,pretty} %buildroot/%_bindir
install -Dp -m644 dist/nimble/nimble.bash-completion %{buildroot}%{bashcompdir}/nimble
install -Dp -m644 -t%{buildroot}%{_mandir}/man1 %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4
@@ -83,34 +89,27 @@ for comp in tools/*.zsh-completion; do
install -Dm644 $comp %zshcompdir/_$(basename "${comp/.zsh-completion}")
done
%ifarch x86_64
mkdir -p %buildroot%_docdir/%name/html
cp -a doc/html/*.html %buildroot%_docdir/%name/html/
cp tools/dochack/dochack.js %{buildroot}%{_docdir}/%{name}/
cp -a lib %buildroot%_prefix/lib/nim
ln -s %_datadir/nim/doc %buildroot%_prefix/lib/nim/doc
%endif
cp -a lib %buildroot%_prefix/lib/
mv %buildroot%_prefix/lib/{lib,nim}
cp -a compiler %buildroot%_prefix/lib/nim
install -Dm644 nim.nimble %buildroot%_prefix/lib/nim/compiler
ls **
ls %buildroot%_prefix/lib/nim/*
install -m755 lib/libnimrtl.so %buildroot%_prefix/lib/libnimrtl.so
install -m755 lib/libnimrtl.so %buildroot%_prefix/lib/libnimrtl.so # compiler needs
install -Dm644 config/* -t %buildroot/etc/nim
install -Dm755 bin/* -t %buildroot%_bindir
install -d %buildroot%_includedir
cp -a %buildroot%_prefix/lib/nim/lib/*.h %buildroot%_includedir
ln -s %_datadir/nim/doc %buildroot%_prefix/lib/nim/doc
ln -s %_prefix/lib/nim %buildroot%_prefix/lib/nim/lib
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
rm -rf %buildroot/nim || true
rm %buildroot%_bindir/*.bat || true
%check
# export PATH=$PATH:$(realpath ./bin)
# for cat in manyloc gc threads nimble-all lib io async rodfiles debugger examples dll flags
# do
# ./koch tests --pedantic category $cat -d:nimCoroutines || (echo "$cat test category failed" && exit 1)
# done
%files
%license copying.txt dist/nimble/license.txt
@@ -133,8 +132,10 @@ rm %buildroot%_bindir/*.bat || true
%{_bindir}/nim{grep,suggest,pretty}
%{_mandir}/man1/nim{grep,suggest}.1*
%ifarch x86_64
%files doc
%doc %{_docdir}/nim
%endif
%changelog
%autochangelog
+7 -1
View File
@@ -1,5 +1,5 @@
Name: anda-srpm-macros
Version: 0.1.5
Version: 0.1.6
Release: 1%{?dist}
Summary: SRPM macros for extra Fedora packages
@@ -9,6 +9,7 @@ Source0: macros.cargo_extra
Source1: macros.caching
Source2: macros.anda
Source3: macros.go_extra
Source4: macros.nim_extra
Recommends: rust-packaging
Requires: git-core
@@ -28,15 +29,20 @@ 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}
%files
%{_rpmmacrodir}/macros.cargo_extra
%{_rpmmacrodir}/macros.caching
%{_rpmmacrodir}/macros.anda
%{_rpmmacrodir}/macros.go_extra
%{_rpmmacrodir}/macros.nim_extra
%changelog
* Wed Mar 13 2024 madonuko <mado@fyralabs.com> - 0.1.6-1
- Add nim_c, nim_tflags and nim_lflags
* Thu Aug 3 2023 madonuko <mado@fyralabs.com> - 0.1.4-1
- Add go_build_online and go_prep_online
+5
View File
@@ -0,0 +1,5 @@
%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"