%bcond check 0 %bcond doc 0 %global __nim_common_opts -d:release --parallelBuild:%{_smp_build_ncpus} # https://github.com/nim-lang/Nim/blob/v2.2.6/koch.nim#L169 %global atlas_commit 9cf7e5fb46d341b7e8755312ed460d130a091a72 %global sat_commit faf1617f44d7632ee9601ebc13887644925dcc01 # https://github.com/nim-lang/Nim/blob/v2.2.6/tools/kochdocs.nim#L352 # "asyncftpclient", "punycode", "smtp", "db_connector", "checksums", "atlas", "htmlparser" %global asyncftpclient_commit 0350c36d9545040f1038258d7a815493a6103de0 %global punycode_commit 03fa3cf9f37c0fbcbdf400c37d9be7a458660dd6 %global smtp_commit 46ad524ada896bc45869d63077362718ca52873b %global db_connector_commit fba8db1fee20d73e07d79a1af1539fe7d129d065 %global checksums_commit 8ee781a713184dcf66ea0235aad865fa65b5c7ff %global htmlparser_commit c3ab4d5157759ad1a3b67be5b4562f44c55c0ef7 Name: nim Version: 2.2.6 Release: %autorelease Summary: Statically typed, imperative programming language # compiler is MIT, nimble package manager is BSD-3-Clause License: MIT and BSD-3-Clause URL: https://nim-lang.org Source0: https://nim-lang.org/download/%{name}-%{version}.tar.xz Source1: https://github.com/nim-lang/atlas/archive/%{atlas_commit}/atlas-%{atlas_commit}.tar.gz Source2: https://github.com/nim-lang/sat/archive/%{sat_commit}/sat-%{sat_commit}.tar.gz Source3: https://github.com/nim-lang/asyncftpclient/archive/%{asyncftpclient_commit}/asyncftpclient-%{asyncftpclient_commit}.tar.gz Source4: https://github.com/nim-lang/punycode/archive/%{punycode_commit}/punycode-%{punycode_commit}.tar.gz Source5: https://github.com/nim-lang/smtp/archive/%{smtp_commit}/smtp-%{smtp_commit}.tar.gz Source6: https://github.com/nim-lang/db_connector/archive/%{db_connector_commit}/db_connector-%{db_connector_commit}.tar.gz Source7: https://github.com/nim-lang/checksums/archive/%{checksums_commit}/checksums-%{checksums_commit}.tar.gz Source8: https://github.com/nim-lang/htmlparser/archive/%{htmlparser_commit}/htmlparser-%{htmlparser_commit}.tar.gz Patch1: nim-0001-allow-to-override-directories-in-install-script.patch Patch2: nim-0002-use-_datadir-for-platform-independent-library-path.patch Patch3: nim-0003-use-versioned-source-links-in-docs.patch BuildRequires: gcc BuildRequires: openssl-devel BuildRequires: pcre %if %{with doc} BuildRequires: gcc-c++ BuildRequires: git %endif %if %{with check} BuildRequires: gc-devel # https://fedoraproject.org/wiki/Changes/NodejsAlternativesSystem BuildRequires: nodejs BuildRequires: %{_bindir}/node BuildRequires: valgrind BuildRequires: SFML-devel %endif # Default gcc options in nim.conf include hardened specs Requires: redhat-rpm-config # Currently compiler uses C sources as intermediate representation Requires: gcc Recommends: %{name}-tools%{_isa} = %{version}-%{release} # for using --gc:boehm Suggests: gc-devel Suggests: %{name}-doc = %{version}-%{release} %description Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority). %package tools Summary: Tools for Nim programming language %description tools This package provides tools for Nim programming language. %if %{with doc} %package doc Summary: Documentation for Nim programming language BuildArch: noarch %description doc This package provides documentation and reference manual for the language and its standard library. %endif %prep %setup -q -n %{name}-%{version} -a0 -a1 -a2 -a3 -a4 -a5 -a6 -a7 -a8 %autopatch -p1 cp -r atlas-%{atlas_commit} dist/atlas mkdir -p dist/atlas/dist mv -v sat-%{sat_commit} dist/atlas/dist/sat mkdir -p pkgs mv -v asyncftpclient-%{asyncftpclient_commit} pkgs/asyncftpclient mv -v punycode-%{punycode_commit} pkgs/punycode mv -v smtp-%{smtp_commit} pkgs/smtp mv -v db_connector-%{db_connector_commit} pkgs/db_connector mv -v checksums-%{checksums_commit} pkgs/checksums mv -v atlas-%{atlas_commit} pkgs/atlas mv -v htmlparser-%{htmlparser_commit} pkgs/htmlparser # Use Fedora default flags sed -i -e 's/-O3/-O2/g' -e 's/-Os/-O2/g' \ build.sh \ config/nim.cfg \ compiler/extccomp.nim for file in {compiler,config}/nim.cfg; do \ echo "gcc.options.always %= \"\${gcc.options.always} ${CFLAGS:-%optflags}\"" >> $file echo "gcc.options.linker %= \"\${gcc.options.linker} ${LDFLAGS:-%__global_ldflags}\"" >> $file done %build # build bootstrap compiler ./build.sh # build the koch management tool ./bin/nim compile %__nim_common_opts koch # build a new version of the compiler ./koch boot %__nim_common_opts # build tools ./koch tools %__nim_common_opts # generate documentation # use --docCmd:skip to skip runnable examples because some require network access ./koch --localdocs doc --docCmd:skip sed -i '/