Compare commits

...

1 Commits

Author SHA1 Message Date
sadlerm4 d2b7f887fd chore(el10): rm packages in nim 2025-02-14 17:48:29 +11:00
26 changed files with 0 additions and 2190 deletions
-6
View File
@@ -1,6 +0,0 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "choosenim.spec"
}
}
-41
View File
@@ -1,41 +0,0 @@
Name: choosenim
Version: 0.8.12
Release: 1%?dist
Summary: Easily install and manage multiple versions of the Nim programming language
License: BSD-3-Clause
URL: https://github.com/nim-lang/choosenim
Source0: %url/archive/refs/tags/v%version.tar.gz
# Fix for https://github.com/nim-lang/choosenim/issues/13
Patch0: https://patch-diff.githubusercontent.com/raw/nim-lang/choosenim/pull/38.patch
Packager: madonuko <mado@fyralabs.com>
BuildRequires: nim
BuildRequires: git-core anda-srpm-macros
%description
choosenim installs the Nim programming language from official downloads and
sources, enabling you to easily switch between stable and development compilers.
%prep
%autosetup -p1
#? https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=choosenim
# we compile proxyexe in a separate step
sed -i -e '/static: compileProxyexe()/d' src/choosenimpkg/switcher.nim
%nim_prep
%build
%nim_c -p:/usr/lib/nim/dist/nimble/src/ -p:`pwd` src/choosenimpkg/proxyexe
strip src/choosenimpkg/proxyexe
%nim_c -p:/usr/lib/nim/dist/nimble/src/ -p:`pwd` src/choosenim
%install
install -Dm755 src/choosenim %buildroot%_bindir/choosenim
%files
%doc readme.md
%license LICENSE
%_bindir/choosenim
%changelog
%autochangelog
-1
View File
@@ -1 +0,0 @@
rpm.version(gh("nim-lang/choosenim"));
-5
View File
@@ -1,5 +0,0 @@
project pkg {
rpm {
spec = "umdive.spec"
}
}
-29
View File
@@ -1,29 +0,0 @@
Name: umdive
Version: 0.1.3
Release: 1%?dist
Summary: Chroot utility (just like arch-chroot)
License: MIT
URL: https://github.com/Ultramarine-Linux/dive
Source0: %url/archive/refs/tags/v%version.tar.gz
Requires: (%_bindir/chroot or %_sbindir/chroot)
Requires: %_bindir/mount
BuildRequires: anda-srpm-macros nim mock
Provides: dive = %version-%release
%description
%summary.
%prep
%autosetup -n dive-%version
%nim_prep
%build
%nim_c src/dive
%install
install -Dpm755 src/dive %buildroot%_bindir/dive
%files
%doc README.md
%license LICENSE
%_bindir/dive
-1
View File
@@ -1 +0,0 @@
rpm.version(gh("Ultramarine-Linux/dive"));
-5
View File
@@ -1,5 +0,0 @@
project pkg {
rpm {
spec = "mkfstab.spec"
}
}
-26
View File
@@ -1,26 +0,0 @@
Name: mkfstab
Version: 0.1.3
Release: 1%?dist
Summary: An alternative to genfstab: generate output suitable for addition to /etc/fstab
License: MIT
URL: https://github.com/Ultramarine-Linux/mkfstab
Source0: %url/archive/refs/tags/v%version.tar.gz
BuildRequires: nim anda-srpm-macros
%description
An alternative to genfstab from Arch Linux. This is a dead simple but faster implementation of genfstab.
%prep
%autosetup
%build
nimble setup -y
%nim_c src/%name
%install
install -Dpm755 src/%name %buildroot%_bindir/%name
%files
%doc README.md
%license LICENSE
%_bindir/%name
-1
View File
@@ -1 +0,0 @@
rpm.version(gh("Ultramarine-Linux/mkfstab"));
-8
View File
@@ -1,8 +0,0 @@
project pkg {
rpm {
spec = "nim-nightly.spec"
}
labels {
nightly = "1"
}
}
-153
View File
@@ -1,153 +0,0 @@
%global csrc_commit 561b417c65791cd8356b5f73620914ceff845d10
%global commit 1a7bc6d878ff04709ebb1002010fd53b4ba02179
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global ver 2.3.1
%global commit_date 20250211
%global debug_package %nil
Name: nim-nightly
Version: %ver^%commit_date.%shortcommit
Release: 1%?dist
Summary: Imperative, multi-paradigm, compiled programming language
License: MIT and BSD
URL: https://nim-lang.org
Source0: https://github.com/nim-lang/Nim/archive/%commit.tar.gz
Source1: nim.1
Source2: nimgrep.1
Source3: nimble.1
Source4: nimsuggest.1
BuildRequires: gcc mold git gcc-c++ nodejs openssl-devel pkgconfig(bash-completion) gc-devel pcre pcre-devel
Requires: redhat-rpm-config gcc
Conflicts: choosenim
# somehow wrong name and never noticed
Provides: nim-nightly = %version-%release
Obsoletes: nim-nighlty < 2.1.1^20240404.9e1b170-2
%description
Nim is a compiled, garbage-collected systems programming language with a
design that focuses on efficiency, expressiveness, and elegance (in that
order of priority).
%package tools
Summary: Tools for Nim programming language
Provides: nim-nightly-tools = %version-%release
Obsoletes: nim-nighlty-tools < 2.1.1^20240404.9e1b170-2
%description tools
Nim is a compiled, garbage-collected systems programming language with a
design that focuses on efficiency, expressiveness, and elegance (in that
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
Provides: nim-nightly-doc = %version-%release
Obsoletes: nim-nighlty-doc < 2.1.1^20240404.9e1b170-2
%description doc
Nim is a compiled, garbage-collected systems programming language with a
design that focuses on efficiency, expressiveness, and elegance (in that
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"
export FFLAGS="${FFLAGS} -Ofast"
export FCFLAGS="${FCFLAGS} -Ofast"
export PATH="$(pwd):$(pwd)/bin:${PATH}"
. ci/funs.sh
nimBuildCsourcesIfNeeded CFLAGS="${CFLAGS} -Ic_code -w -O3 -fno-strict-aliasing -fPIE" LDFLAGS="-ldl -lm -lrt -pie"
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}"
# --main:compiler/nim.nim
mold -run bin/nim cc -d:nimCallDepthLimit=10000 -r tools/niminst/niminst --var:version=%ver --var:mingw=none scripts compiler/installer.ini
sh ./install.sh %buildroot/usr/bin
mkdir -p %buildroot/%_bindir %buildroot/%_datadir/bash-completion/completions %buildroot/usr/lib/nim %buildroot%_datadir
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
mv %buildroot%_bindir/nim %buildroot%_datadir/
ln -s %_datadir/nim/bin/nim %buildroot%_bindir/nim
%ifarch x86_64
mkdir -p %buildroot/%_docdir/%name/html || true
cp -a doc/html/*.html %buildroot/%_docdir/%name/html/ || true
cp tools/dochack/dochack.js %buildroot/%_docdir/%name/ || true
%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
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
%doc doc/readme.txt
%_bindir/nim{,ble}
%_mandir/man1/nim{,ble}.1*
%_datadir/bash-completion/completions/nim{,ble}
%_datadir/nim/
%_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
%autochangelog
-649
View File
@@ -1,649 +0,0 @@
.TH NIM 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nim \- Nim compiler
.SH SYNOPSIS
.PP
\fB\fCnim\fR \fB\fCcommand\fR [\fIoptions\fP] [\fIprojectfile\fP] [\fIarguments\fP]
.SH COMMANDS
.PP
Basic commands
.PP
\fB\fCcompile\fR, \fB\fCc\fR
compile project with default code generator (C)
.PP
\fB\fCdoc\fR
generate the documentation for inputfile
.PP
\fB\fCdoc2\fR
generate the documentation for the whole project
.SH OPTIONS
.PP
\fB\fC\-p\fR, \fB\fC\-\-path\fR:\fIPATH\fP
add path to search paths
.PP
\fB\fC\-d\fR, \fB\fC\-\-define\fR:\fISYMBOL\fP(:\fIVAL\fP)
define a conditional symbol (optionally: define the value for that symbol)
.PP
\fB\fC\-u\fR, \fB\fC\-\-undef\fR:\fISYMBOL\fP
undefine a conditional symbol
.PP
\fB\fC\-f\fR, \fB\fC\-\-forceBuild\fR
force rebuilding of all modules
.PP
\fB\fC\-\-stackTrace\fR:\fIon\fP|\fIoff\fP
turn stack tracing on|off
.PP
\fB\fC\-\-lineTrace\fR:\fIon\fP|\fIoff\fP
turn line tracing on|off
.PP
\fB\fC\-\-threads\fR:\fIon\fP|\fIoff\fP
turn support for multi\-threading on|off
.PP
\fB\fC\-x\fR, \fB\fC\-\-checks\fR:\fIon\fP|\fIoff\fP
turn all runtime checks on|off
.PP
\fB\fC\-\-objChecks\fR:\fIon\fP|\fIoff\fP
turn obj conversion checks on|off
.PP
\fB\fC\-\-fieldChecks\fR:\fIon\fP|\fIoff\fP
turn case variant field checks on|off
.PP
\fB\fC\-\-rangeChecks\fR:\fIon\fP|\fIoff\fP
turn range checks on|off
.PP
\fB\fC\-\-boundChecks\fR:\fIon\fP|\fIoff\fP
turn bound checks on|off
.PP
\fB\fC\-\-overflowChecks\fR:\fIon\fP|\fIoff\fP
turn int over\-/underflow checks on|off
.PP
\fB\fC\-a\fR, \fB\fC\-\-assertions\fR:\fIon\fP|\fIoff\fP
turn assertions on|off
.PP
\fB\fC\-\-floatChecks\fR:\fIon\fP|\fIoff\fP
turn all floating point (NaN/Inf) checks on|off
.PP
\fB\fC\-\-nanChecks\fR:\fIon\fP|\fIoff\fP
turn NaN checks on|off
.PP
\fB\fC\-\-infChecks\fR:\fIon\fP|\fIoff\fP
turn Inf checks on|off
.PP
\fB\fC\-\-deadCodeElim\fR:\fIon\fP|\fIoff\fP
whole program dead code elimination on|off
.PP
\fB\fC\-\-opt\fR:\fInone\fP|\fIspeed|size\fP
optimize not at all or for speed|size. Note: use \fB\fC\-d:release\fR for a release build!
.PP
\fB\fC\-\-debugger\fR:native|endb*
use native debugger (gdb) | ENDB (experimental)
.PP
\fB\fC\-\-app\fR:\fIconsole\fP|\fIgui\fP|\fIlib\fP|\fIstaticlib\fP
generate a console app, GUI app, DLL, or static library
.PP
\fB\fC\-r\fR, \fB\fC\-\-run\fR
run the compiled program with given arguments
.PP
\fB\fC\-\-advanced\fR
show advanced command line switches
.PP
\fB\fC\-h\fR, \fB\fC\-\-help\fR
show this help
.SH ADVANCED COMMANDS
.PP
\fB\fCcompileToC\fR, \fB\fCcc\fR
compile project with C code generator
.PP
\fB\fCcompileToCpp\fR, \fB\fCcpp\fR
compile project to C++ code
.PP
\fB\fCcompileToOC\fR, \fB\fCobjc\fR
compile project to Objective C code
.PP
\fB\fCjs\fR
compile project to Javascript
.PP
\fB\fCe\fR
run a Nimscript file
.PP
\fB\fCrst2html\fR
convert a reStructuredText file to HTML
.PP
\fB\fCrst2tex\fR
convert a reStructuredText file to TeX
.PP
\fB\fCjsondoc\fR
extract the documentation to a json file
.PP
\fB\fCjsondoc2\fR
extract documentation to a json file (uses doc2)
.PP
\fB\fCbuildIndex\fR
build an index for the whole documentation
.PP
\fB\fCrun\fR
run the project (with Tiny C backend; buggy!)
.PP
\fB\fCgenDepend\fR
generate a DOT file containing the module dependency graph
.PP
\fB\fCdump\fR
dump all defined conditionals and search paths
.PP
\fB\fCcheck\fR
checks the project for syntax and semantic
.SH ADVANCED OPTIONS
.PP
\fB\fC\-o\fR:\fIFILE\fP, \fB\fC\-\-out\fR:\fIFILE\fP
set the output filename
.PP
\fB\fC\-\-stdout\fR
output to stdout
.PP
\fB\fC\-\-colors\fR:\fIon\fP|\fIoff\fP
turn compiler messages coloring on|off
.PP
\fB\fC\-\-listFullPaths\fR
list full paths in messages
.PP
\fB\fC\-w\fR:\fIon\fP|\fIoff\fP|\fIlist\fP, \fB\fC\-\-warnings\fR:\fIon\fP|\fIoff\fP|\fIlist\fP
turn all warnings on|off or list all available
.PP
\fB\fC\-\-warning[X]\fR:\fIon\fP|\fIoff\fP
turn specific warning X on|off
.PP
\fB\fC\-\-hints\fR:\fIon\fP|\fIoff\fP|\fIlist\fP
turn all hints on|off or list all available
.PP
\fB\fC\-\-hint[X]\fR:\fIon\fP|\fIoff\fP
turn specific hint X on|off
.PP
\fB\fC\-\-lib\fR:\fIPATH\fP
set the system library path
.PP
\fB\fC\-\-import\fR:\fIPATH\fP
add an automatically imported module
.PP
\fB\fC\-\-include\fR:\fIPATH\fP
add an automatically included module
.PP
\fB\fC\-\-nimcache\fR:\fIPATH\fP
set the path used for generated files
.PP
\fB\fC\-\-header\fR:\fIFILE\fP
the compiler should produce a .h file (FILE is optional)
.PP
\fB\fC\-c\fR, \fB\fC\-\-compileOnly\fR
compile only; do not assemble or link
.PP
\fB\fC\-\-noLinking\fR
compile but do not link
.PP
\fB\fC\-\-noMain\fR
do not generate a main procedure
.PP
\fB\fC\-\-genScript\fR
generate a compile script (in the 'nimcache' subdirectory named 'compile_$project$scriptext')
.PP
\fB\fC\-\-os\fR:\fISYMBOL\fP
set the target operating system (cross\-compilation)
.PP
\fB\fC\-\-cpu\fR:\fISYMBOL\fP
set the target processor (cross\-compilation)
.PP
\fB\fC\-\-debuginfo\fR
enables debug information
.PP
\fB\fC\-t\fR, \fB\fC\-\-passC\fR:\fIOPTION\fP
pass an option to the C compiler
.PP
\fB\fC\-l\fR, \fB\fC\-\-passL\fR:\fIOPTION\fP
pass an option to the linker
.PP
\fB\fC\-\-cincludes\fR:\fIDIR\fP
modify the C compiler header search path
.PP
\fB\fC\-\-clibdir\fR:\fIDIR\fP
modify the linker library search path
.PP
\fB\fC\-\-clib\fR:\fILIBNAME\fP
link an additional C library (you should omit platform\-specific extensions)
.PP
\fB\fC\-\-genMapping\fR
generate a mapping file containing (Nim, mangled) identifier pairs
.PP
\fB\fC\-\-project\fR
document the whole project (doc2)
.PP
\fB\fC\-\-docSeeSrcUrl\fR:\fIurl\fP
activate 'see source' for doc and doc2 commands (see doc.item.seesrc in config/nimdoc.cfg)
.PP
\fB\fC\-\-lineDir\fR:\fIon\fP|\fIoff\fP
generation of #line directive on|off
.PP
\fB\fC\-\-embedsrc\fR
embeds the original source code as comments in the generated output
.PP
\fB\fC\-\-threadanalysis\fR:\fIon\fP|\fIoff\fP
turn thread analysis on|off
.PP
\fB\fC\-\-tlsEmulation\fR:\fIon\fP|\fIoff\fP
turn thread local storage emulation on|off
.PP
\fB\fC\-\-taintMode\fR:\fIon\fP|\fIoff\fP
turn taint mode on|off
.PP
\fB\fC\-\-implicitStatic\fR:\fIon\fP|\fIoff\fP
turn implicit compile time evaluation on|off
.PP
\fB\fC\-\-patterns\fR:\fIon\fP|\fIoff\fP
turn pattern matching on|off
.PP
\fB\fC\-\-memTracker\fR:\fIon\fP|\fIoff\fP
turn memory tracker on|off
.PP
\fB\fC\-\-excessiveStackTrace\fR:\fIon\fP|\fIoff\fP
stack traces use full file paths
.PP
\fB\fC\-\-skipCfg\fR
do not read the general configuration file
.PP
\fB\fC\-\-skipUserCfg\fR
do not read the user's configuration file
.PP
\fB\fC\-\-skipParentCfg\fR
do not read the parent dirs' configuration files
.PP
\fB\fC\-\-skipProjCfg\fR
do not read the project's configuration file
.PP
\fB\fC\-\-gc\fR:\fIrefc\fP|\fIv2\fP|\fImarkAndSweep\fP|\fIboehm\fP|\fIgo|none\fP|\fIregions\fP
select the GC to use; default is \fB\fCrefc\fR
.PP
\fB\fC\-\-index\fR:\fIon\fP|\fIoff\fP
turn index file generation on|off
.PP
\fB\fC\-\-putenv\fR:\fIkey\fP=\fIvalue\fP
set an environment variable
.PP
\fB\fC\-\-NimblePath\fR:\fIPATH\fP
add a path for Nimble support
.PP
\fB\fC\-\-noNimblePath\fR
deactivate the Nimble path
.PP
\fB\fC\-\-noCppExceptions\fR
use default exception handling with C++ backend
.PP
\fB\fC\-\-excludePath\fR:\fIPATH\fP
exclude a path from the list of search paths
.PP
\fB\fC\-\-dynlibOverride\fR:\fISYMBOL\fP
marks SYMBOL so that dynlib:SYMBOL has no effect and can be statically linked instead; symbol matching is fuzzy so that \fB\fC\-\-dynlibOverride:lua\fR matches dynlib: "liblua.so.3"
.PP
\fB\fC\-\-listCmd\fR
list the commands used to execute external programs
.PP
\fB\fC\-\-parallelBuild\fR:\fI0\fP|\fI1\fP|\fI\&...\fP
perform a parallel build value = number of processors (0 for auto\-detect)
.PP
\fB\fC\-\-verbosity\fR:\fI0\fP|\fI1\fP|\fI2\fP|\fI3\fP
set Nim's verbosity level (1 is default)
.PP
\fB\fC\-\-experimental\fR
enable experimental language features
.PP
\fB\fC\-v\fR, \fB\fC\-\-version\fR
show detailed version information
.SH LIST OF WARNINGS
.PP
Each warning can be activated individually with \fB\fC\-\-warning[NAME]\fR:\fIon\fP|\fIoff\fP or in a \fB\fCpush\fR pragma.
.TS
allbox;
cb cb
l l
l l
l l
l l
l l
l l
l l
l l
.
Name Description
CannotOpenFile Some file not essential for the compiler's working could not be opened.
OctalEscape The code contains an unsupported octal sequence.
Deprecated The code uses a deprecated symbol.
ConfigDeprecated The project makes use of a deprecated config file.
SmallLshouldNotBeUsed The letter 'l' should not be used as an identifier.
EachIdentIsTuple The code contains a confusing var declaration.
ShadowIdent A local variable shadows another local variable of an outer scope.
User Some user defined warning.
.TE
.SH VERBOSITY LEVELS
.PP
\fB\fC0\fR:
Minimal output level for the compiler.
.PP
\fB\fC1\fR:
Displays compilation of all the compiled files, including those imported by other modules or through the compile pragma \[la]https://nim-lang.org/docs/nimc.html#compile-pragma\[ra]\&. This is the default level.
.PP
\fB\fC2\fR:
Displays compilation statistics, enumerates the dynamic libraries that will be loaded by the final binary and dumps to standard output the result of applying a filter to the source code \[la]https://nim-lang.org/docs/filters.html\[ra] if any filter was used during compilation.
.PP
\fB\fC3\fR:
In addition to the previous levels dumps a debug stack trace for compiler developers.
.SH COMPILE TIME SYMBOLS
.PP
Through the \fB\fC\-d\fR:\fIx\fP or \fB\fC\-\-define\fR:\fIx\fP switch you can define compile time symbols for conditional compilation. The defined switches can be checked in source code with the when statement and defined proc. The typical use of this switch is to enable builds in release mode (\fB\fC\-d:release\fR) where certain safety checks are omitted for better performance. Another common use is the \fB\fC\-d:ssl\fR switch to activate SSL sockets.
.PP
Additionally, you may pass a value along with the symbol: \fB\fC\-d\fR:\fIx=y\fP which may be used in conjunction with the compile time define pragmas to override symbols during build time.
.SH CONFIGURATION FILES
.PP
\fINote\fP: The project file name is the name of the \fB\fC\&.nim\fR file that is passed as a command line argument to the compiler.
.PP
The \fB\fCnim\fR executable processes configuration files in the following directories (in this order; later files overwrite previous settings):
.nr step0 0 1
.RS
.IP \n+[step0]
\fB\fC$nim/config/nim.cfg\fR, \fB\fC/etc/nim.cfg\fR (UNIX) or \fB\fC%NIMROD%/config/nim.cfg\fR (Windows). This file can be skipped with the \-\-skipCfg command line option.
.IP \n+[step0]
\fB\fC/home/$user/.config/nim.cfg\fR (UNIX) or \fB\fC%APPDATA%/nim.cfg\fR (Windows). This file can be skipped with the \fB\fC\-\-skipUserCfg\fR command line option.
.IP \n+[step0]
\fB\fC$parentDir/nim.cfg\fR where \fB\fC$parentDir\fR stands for any parent directory of the project file's path. These files can be skipped with the \fB\fC\-\-skipParentCfg\fR command line option.
.IP \n+[step0]
\fB\fC$projectDir/nim.cfg\fR where \fB\fC$projectDir\fR stands for the project file's path. This file can be skipped with the \fB\fC\-\-skipProjCfg\fR command line option.
.IP \n+[step0]
A project can also have a project specific configuration file named \fB\fC$project.nim.cfg\fR that resides in the same directory as \fB\fC$project.nim\fR\&. This file can be skipped with the \fB\fC\-\-skipProjCfg\fR command line option.
Command line settings have priority over configuration file settings.
.RE
.PP
The default build of a project is a debug build. To compile a release build define the \fB\fCrelease\fR symbol:
.PP
.RS
.nf
nim c \-d:release myproject.nim
.fi
.RE
.SH SEARCH PATH HANDLING
.PP
Nim has the concept of a global search path (PATH) that is queried to determine where to find imported modules or include files. If multiple files are found an ambiguity error is produced.
.PP
\fB\fCnim dump\fR shows the contents of the PATH.
.PP
However before the PATH is used the current directory is checked for the file's existence. So if PATH contains $lib and $lib/bar and the directory structure looks like this:
.PP
.RS
.nf
$lib/x.nim
$lib/bar/x.nim
foo/x.nim
foo/main.nim
other.nim
.fi
.RE
.PP
And \fB\fCmain\fR imports \fB\fCx\fR, \fB\fCfoo/x\fR is imported. If \fB\fCother\fR imports \fB\fCx\fR then both \fB\fC$lib/x.nim\fR and \fB\fC$lib/bar/x.nim\fR match and so the compiler should reject it. Currently however this check is not implemented and instead the first matching file is used.
.SH GENERATED C CODE DIRECTORY
.PP
The generated files that Nim produces all go into a subdirectory called \fB\fCnimcache\fR in your project directory. This makes it easy to delete all generated files. Files generated in this directory follow a naming logic which you can read about in the Nim Backend Integration document \[la]https://nim-lang.org/docs/backends.html#nimcache-naming-logic\[ra]\&.
.PP
However, the generated C code is not platform independent. C code generated for Linux does not compile on Windows, for instance. The comment on top of the C file lists the OS, CPU and CC the file has been compiled for.
.SH COMPILATION CACHE
.PP
\fIWarning\fP: The compilation cache is still highly experimental!
.PP
The \fB\fCnimcache\fR directory may also contain so called rod or symbol files. These files are pre\-compiled modules that are used by the compiler to perform incremental compilation. This means that only modules that have changed since the last compilation (or the modules depending on them etc.) are re\-compiled. However, per default no symbol files are generated; use the \fB\fC\-\-symbolFiles:on\fR command line switch to activate them.
.PP
Unfortunately due to technical reasons the \fB\fC\-\-symbolFiles:on\fR needs to aggregate some generated C code. This means that the resulting executable might contain some cruft even when dead code elimination is turned on. So the final release build should be done with \fB\fC\-\-symbolFiles:off\fR\&.
.PP
Due to the aggregation of C code it is also recommended that each project resides in its own directory so that the generated \fB\fCnimcache\fR directory is not shared between different projects.
.SH COMPILER SELECTION
.PP
To change the compiler from the default compiler (at the command line):
.PP
.RS
.nf
nim c \-\-cc:llvm_gcc \-\-compile_only myfile.nim
.fi
.RE
.PP
This uses the configuration defined in \fB\fCconfig\\nim.cfg\fR for \fB\fCllvm_gcc\fR\&.
.PP
If \fB\fCnimcache\fR already contains compiled code from a different compiler for the same project, add the \fB\fC\-f\fR flag to force all files to be recompiled.
.PP
The default compiler is defined at the top of \fB\fCconfig\\nim.cfg\fR\&. Changing this setting affects the compiler used by \fB\fCkoch\fR to (re)build Nim.
.SH CROSS COMPILATION
.PP
To cross compile, use for example:
.PP
.RS
.nf
nim c \-\-cpu:i386 \-\-os:linux \-\-compileOnly \-\-genScript myproject.nim
.fi
.RE
.PP
Then move the C code and the compile script \fB\fCcompile_myproject.sh\fR to your Linux i386 machine and run the script.
.PP
Another way is to make Nim invoke a cross compiler toolchain:
.PP
.RS
.nf
nim c \-\-cpu:arm \-\-os:linux myproject.nim
.fi
.RE
.PP
For cross compilation, the compiler invokes a C compiler named like \fB\fC$cpu.$os.$cc\fR (for example \fB\fCarm.linux.gcc\fR) and the configuration system is used to provide meaningful defaults. For example for \fIARM\fP your configuration file should contain something like:
.PP
.RS
.nf
arm.linux.gcc.path = "/usr/bin"
arm.linux.gcc.exe = "arm\-linux\-gcc"
arm.linux.gcc.linkerexe = "arm\-linux\-gcc"
.fi
.RE
.PP
DLL GENERATION
.PP
Nim supports the generation of DLLs. However, there must be only one instance of the GC per process/address space. This instance is contained in \fB\fCnimrtl.dll\fR\&. This means that every generated Nim DLL depends on \fB\fCnimrtl.dll\fR\&. To generate the "nimrtl.dll" file, use the command:
.PP
.RS
.nf
nim c \-d:release lib/nimrtl.nim
.fi
.RE
.PP
To link against nimrtl.dll use the command:
.PP
.RS
.nf
nim c \-d:useNimRtl myprog.nim
.fi
.RE
.PP
\fINote\fP: Currently the creation of \fB\fCnimrtl.dll\fR with thread support has never been tested and is unlikely to work!
.SH ADDITIONAL COMPILATION SWITCHES
.PP
The standard library supports a growing number of \fB\fCuseX\fR conditional defines affecting how some features are implemented. This section tries to give a complete list.
.PP
\fB\fC\-d:release\fR
Turns off runtime checks and turns on the optimizer.
.PP
\fB\fC\-d:useWinAnsi\fR
Modules like \fB\fCos\fR and \fB\fCosproc\fR use the ANSI versions of the Windows API. The default build uses the Unicode version.
.PP
\fB\fC\-d:useFork\fR
Makes \fB\fCosproc\fR use \fB\fCfork\fR instead of \fB\fCposix_spawn\fR\&.
.PP
\fB\fC\-d:useNimRtl\fR
Compile and link against \fB\fCnimrtl.dll\fR\&.
.PP
\fB\fC\-d:useMalloc\fR
Makes Nim use C's malloc instead of Nim's own memory manager, ableit prefixing each allocation with its size to support clearing memory on reallocation. This only works with \fB\fCgc:none\fR\&.
.PP
\fB\fC\-d:useRealtimeGC\fR
Enables support of Nim's GC for soft realtime systems. See the documentation of the gc \[la]https://nim-lang.org/docs/gc.html\[ra] for further information.
.PP
\fB\fC\-d:nodejs\fR
The JS target is actually \fB\fCnode.js\fR\&.
.PP
\fB\fC\-d:ssl\fR
Enables OpenSSL support for the sockets module.
.PP
\fB\fC\-d:memProfiler\fR
Enables memory profiling for the native GC.
.PP
\fB\fC\-d:uClibc\fR
Use uClibc instead of libc. (Relevant for Unix\-like OSes)
.PP
\fB\fC\-d:checkAbi\fR
When using types from C headers, add checks that compare what's in the Nim file with what's in the C header (requires a C compiler with \fIStatic\fPassert support, like any C11 compiler)
.PP
\fB\fC\-d:tempDir\fR:\fIPATH\fP
This symbol takes a string as its value, like \fB\fC\-\-define:tempDir:/some/temp/path\fR to override the temporary directory returned by \fB\fCos.getTempDir()\fR\&. The value should end with a directory separator character. (Relevant for the Android platform)
.PP
\fB\fC\-d:useShPath\fR:\fIPATH\fP
This symbol takes a string as its value, like \fB\fC\-\-define:useShPath:/opt/sh/bin/sh\fR to override the path for the \fB\fCsh\fR binary, in cases where it is not located in the default location \fB\fC/bin/sh\fR\&.
.SH ADDITIONAL FEATURES
.PP
This section describes Nim's additional features that are not listed in the Nim manual. Some of the features here only make sense for the C code generator and are subject to change.
.PP
\fILineDir option\fP
The \fB\fClineDir\fR option can be turned on or off. If turned on the generated C code contains \fB\fC#line\fR directives. This may be helpful for debugging with GDB.
.PP
\fIStackTrace option\fP
If the \fB\fCstackTrace\fR option is turned on, the generated C contains code to ensure that proper stack traces are given if the program crashes or an uncaught exception is raised.
.PP
\fILineTrace option\fP
The \fB\fClineTrace\fR option implies the \fB\fCstackTrace\fR option. If turned on, the generated C contains code to ensure that proper stack traces with line number information are given if the program crashes or an uncaught exception is raised.
.PP
\fIDebugger option\fP
The \fB\fCdebugger\fR option enables or disables the \fIEmbedded Nim Debugger\fP\&. See the documentation of endb \[la]https://nim-lang.org/docs/endb.html\[ra] for further information.
.PP
\fIBreakpoint pragma\fP
The breakpoint pragma was specially added for the sake of debugging with ENDB. See the documentation of endb \[la]https://nim-lang.org/docs/endb.html\[ra] for further information.
.SH DynlibOverride
.PP
By default Nim's \fB\fCdynlib\fR pragma causes the compiler to generate \fB\fCGetProcAddress\fR (or their Unix counterparts) calls to bind to a DLL. With the \fB\fCdynlibOverride\fR command line switch this can be prevented and then via \fB\fC\-\-passL\fR the static library can be linked against. For instance, to link statically against Lua this command might work on Linux:
.PP
.RS
.nf
nim c \-\-dynlibOverride:lua \-\-passL:liblua.lib program.nim
.fi
.RE
.SH BACKEND LANGUAGE OPTIONS
.PP
The typical compiler usage involves using the \fB\fCcompile\fR or \fB\fCc\fR command to transform a \fB\fC\&.nim\fR file into one or more \fB\fC\&.c\fR files which are then compiled with the platform's C compiler into a static binary. However there are other commands to compile to C++, Objective\-C or Javascript. More details can be read in the Nim Backend Integration document \[la]https://nim-lang.org/docs/backends.html\[ra]\&.
.SH NIM DOCUMENTATION TOOLS
.PP
Nim provides the \fB\fCdoc\fR and \fB\fCdoc2\fR commands to generate HTML documentation from \fB\fC\&.nim\fR source files. Only exported symbols will appear in the output. For more details see the docgen documentation \[la]https://nim-lang.org/docs/docgen.html\[ra]\&.
.SH NIM IDETOOLS INTEGRATION
.PP
Nim provides language integration with external IDEs through the \fB\fCidetools\fR command. See the documentation of idetools \[la]https://nim-lang.org/docs/idetools.html\[ra] for further information.
.SH NIM FOR EMBEDDED SYSTEMS
.PP
The standard library can be avoided to a point where C code generation for 16bit micro controllers is feasible. Use the standalone target (\fB\fC\-\-os:standalone\fR) for a bare bones standard library that lacks any OS features.
.PP
To make the compiler output code for a 16bit target use the \fB\fC\-\-cpu:avr\fR target.
.PP
For example, to generate code for an AVR processor use this command:
.PP
.RS
.nf
nim c \-\-cpu:avr \-\-os:standalone \-\-deadCodeElim:on \-\-genScript x.nim
.fi
.RE
.PP
For the \fB\fCstandalone\fR target one needs to provide a file \fB\fCpanicoverride.nim\fR\&. See \fB\fCtests/manyloc/standalone/panicoverride.nim\fR for an example implementation. Additionally, users should specify the amount of heap space to use with the \fB\fC\-d:StandaloneHeapSize\fR=\fISIZE\fP command line switch. Note that the total heap size will be \fB\fCSIZE * sizeof(float64)\fR\&.
.SH NIM FOR REALTIME SYSTEMS
.PP
See the documentation of Nim's soft realtime GC \[la]https://nim-lang.org/docs/gc.html\[ra] for further information.
.SH DEBUGGING WITH NIM
.PP
Nim comes with its own \fIEmbedded Nim Debugger\fP\&. See the documentation of endb \[la]https://nim-lang.org/docs/endb.html\[ra] for further information.
.SH OPTIMIZING FOR NIM
.PP
Nim has no separate optimizer, but the C code that is produced is very efficient. Most C compilers have excellent optimizers, so usually it is not needed to optimize one's code. Nim has been designed to encourage efficient code: The most readable code in Nim is often the most efficient too.
.PP
However, sometimes one has to optimize. Do it in the following order:
.nr step1 0 1
.RS
.IP \n+[step1]
switch off the embedded debugger (it is slow!)
.IP \n+[step1]
turn on the optimizer and turn off runtime checks
.IP \n+[step1]
profile your code to find where the bottlenecks are
.IP \n+[step1]
try to find a better algorithm
.IP \n+[step1]
do low\-level optimizations
.RE
.PP
This section can only help you with the last item.
.PP
\fIOptimizing string handling\fP
.PP
String assignments are sometimes expensive in Nim: They are required to copy the whole string. However, the compiler is often smart enough to not copy strings. Due to the argument passing semantics, strings are never copied when passed to subroutines. The compiler does not copy strings that are a result from a procedure call, because the callee returns a new string anyway. Thus it is efficient to do:
.PP
.RS
.nf
var s = procA() # assignment will not copy the string; procA allocates a new
# string already
.fi
.RE
.PP
However it is not efficient to do:
.PP
.RS
.nf
var s = varA # assignment has to copy the whole string into a new buffer!
.fi
.RE
.PP
For \fB\fClet\fR symbols a copy is not always necessary:
.PP
.RS
.nf
let s = varA # may only copy a pointer if it safe to do so
.fi
.RE
.PP
If you know what you're doing, you can also mark single string (or sequence) objects as shallow:
.PP
.RS
.nf
var s = "abc"
shallow(s) # mark 's' as shallow string
var x = s # now might not copy the string!
.fi
.RE
.PP
Usage of \fB\fCshallow\fR is always safe once you know the string won't be modified anymore, similar to Ruby's freeze.
.PP
The compiler optimizes string case statements: A hashing scheme is used for them if several different string constants are used. So code like this is reasonably efficient:
.PP
.RS
.nf
case normalize(k.key)
of "name": c.name = v
of "displayname": c.displayName = v
of "version": c.version = v
of "os": c.oses = split(v, {';'})
of "cpu": c.cpus = split(v, {';'})
of "authors": c.authors = split(v, {';'})
of "description": c.description = v
of "app":
case normalize(v)
of "console": c.app = appConsole
of "gui": c.app = appGUI
else: quit(errorStr(p, "expected: console or gui"))
of "license": c.license = UnixToNativePath(k.value)
else: quit(errorStr(p, "unknown variable: " & k.key))
.fi
.RE
.SH SEE ALSO
.PP
Official documentation \[la]https://nim-lang.org/documentation.html\[ra],
.BR nimgrep (1)
-97
View File
@@ -1,97 +0,0 @@
.TH NIMBLE 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nimble \- package manager for the Nim programming language.
.SH SYNOPSIS
.PP
\fB\fCnimble\fR \fIcommand\fP [\fIcommand\-options\fP]
.SH COMMANDS
.PP
\fB\fCinstall\fR [\fB\fC\-d\fR, \fB\fC\-\-depsOnly\fR] [\fIpkgname\fP, \fI\&...\fP]
Install a list of packages (\fB\fC\-d\fR switch for only dependencies).
.PP
\fB\fCdevelop\fR [\fIpkgname\fP, \fI\&...\fP]
Clone a list of packages for development. Symlinks the cloned packages or any package in the current working directory.
.PP
\fB\fCcheck\fR
Verify the validity of a package in the current working directory.
.PP
\fB\fCinit\fR [\fIpkgname\fP]
Initialize a new Nimble project.
.PP
\fB\fCpublish\fR
Publish a package on nim\-lang/packages. The current working directory needs to be the toplevel directory of the Nimble package.
.PP
\fB\fCuninstall\fR [\fIpkgname\fP, \fI\&...\fP]
Uninstall a list of packages.
.PP
\fB\fCbuild\fR
Build a package.
.PP
\fB\fCc\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build a file inside a package using \fB\fCC\fR backend.
.PP
\fB\fCcc\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build a file inside a package using \fB\fCC++\fR backend.
.PP
\fB\fCjs\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build a file inside a package using \fB\fCJavascript\fR backend.
.PP
\fB\fCtest\fR
Compile and execute tests
.PP
\fB\fCdoc\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build documentation for a file inside a package.
.PP
\fB\fCdoc2\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build documentation with semantic checking for a file inside a package.
.PP
\fB\fCrefresh\fR [\fIurl\fP]
Refresh the package list. A package list URL can be optionally specified.
.PP
\fB\fCsearch\fR [\fB\fC\-\-ver\fR] \fIpkg\fP/\fItag\fP
Search for a specified package by tag and by name. With \fB\fC\-\-ver\fR remote server will be asked for package versions.
.PP
\fB\fClist\fR [\fB\fC\-\-ver\fR]
List all packages. With \fB\fC\-\-ver\fR remote server will be asked for package versions. With \fB\fC\-i\fR results will be limited to locally installed packages.
.PP
\fB\fCtasks\fR
List the tasks specified in the Nimble package's Nimble file.
.PP
\fB\fCpath\fR \fIpkgname\fP \fI\&...\fP
Shows absolute path to the installed packages specified.
.PP
\fB\fCdump\fR [\fIpkgname\fP]
Outputs Nimble package information for external tools. The argument can be a .nimble file, a project directory or the name of an installed package.
.SH OPTIONS
.PP
\fB\fC\-h\fR, \fB\fC\-\-help\fR
Print this help message.
.PP
\fB\fC\-v\fR, \fB\fC\-\-version\fR
Print version information.
.PP
\fB\fC\-y\fR, \fB\fC\-\-accept\fR
Accept all interactive prompts.
.PP
\fB\fC\-n\fR, \fB\fC\-\-reject\fR
Reject all interactive prompts.
.PP
\fB\fC\-\-ver\fR
Query remote server for package version information when searching or listing packages
.PP
\fB\fC\-\-nimbleDir\fR:\fIdirname\fP
Set the Nimble directory.
.PP
\fB\fC\-\-verbose\fR
Show all non\-debug output.
.PP
\fB\fC\-\-debug\fR
Show all output including debug messages.
.PP
\fB\fC\-\-noColor\fR
Don't colorise output.
.SH SEE ALSO
.PP
.BR nim (1),
README \[la]https://github.com/nim-lang/nimble#readme\[ra]
-60
View File
@@ -1,60 +0,0 @@
.TH NIMGREP 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nimgrep \- search and replace strings matching pattern
.SH SYNOPSIS
.PP
\fB\fCnimgrep\fR [\fIoptions\fP] [\fIpattern\fP] [\fIreplacement\fP] [\fIFILE\fP/\fIDIRECTORY\fP\&...]
.SH DESCRIPTION
.PP
Nimgrep is a command line tool for search&replace tasks. It can search for regex or peg patterns and can search whole directories at once. User confirmation for every single replace operation can be requested.
.PP
Nimgrep has particularly good support for Nim's eccentric \fIstyle insensitivity\fP\&. Apart from that it is a generic text manipulation tool.
.SH OPTIONS
.PP
\fB\fC\-\-find\fR, \fB\fC\-f\fR
find the pattern (default)
.PP
\fB\fC\-\-replace\fR, \fB\fC\-r\fR
replace the pattern
.PP
\fB\fC\-\-peg\fR
pattern is a peg
.PP
\fB\fC\-\-re\fR
pattern is a regular expression (default); extended syntax for the regular expression is always turned on
.PP
\fB\fC\-\-recursive\fR
process directories recursively
.PP
\fB\fC\-\-confirm\fR
confirm each occurrence/replacement; there is a chance to abort any time without touching the file
.PP
\fB\fC\-\-stdin\fR
read pattern from stdin (to avoid the shell's confusing quoting rules)
.PP
\fB\fC\-\-word\fR, \fB\fC\-w\fR
the match should have word boundaries (buggy for pegs!)
.PP
\fB\fC\-\-ignoreCase\fR, \fB\fC\-i\fR
be case insensitive
.PP
\fB\fC\-\-ignoreStyle\fR, \fB\fC\-y\fR
be style insensitive
.PP
\fB\fC\-\-ext\fR:\fIEX1\fP|\fIEX2\fP|\fI\&...\fP
only search the files with the given
.BR extension (s)
.PP
\fB\fC\-\-verbose\fR
be verbose: list every processed file
.PP
\fB\fC\-\-help\fR, \fB\fC\-h\fR
shows this help
.PP
\fB\fC\-\-version\fR, \fB\fC\-v\fR
shows the version
.SH SEE ALSO
.PP
.BR nim (1),
Official documentation \[la]https://nim-lang.org/documentation.html\[ra]
-42
View File
@@ -1,42 +0,0 @@
.TH NIMSUGGEST 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nimsuggest \- tool to give every editor IDE like capabilities for Nim
.SH SYNOPSIS
.PP
\fB\fCnimsuggest\fR [\fIoptions\fP] \fIprojectfile.nim\fP
.SH OPTIONS
.PP
\fB\fC\-\-port\fR:\fIPORT\fP
port, by default 6000
.PP
\fB\fC\-\-address\fR:\fIHOST\fP
binds to that address, by default ""
.PP
\fB\fC\-\-stdin\fR
read commands from stdin and write results to stdout instead of using sockets
.PP
\fB\fC\-\-epc\fR
use emacs epc mode
.PP
\fB\fC\-\-debug\fR
enable debug output
.PP
\fB\fC\-\-log\fR
enable verbose logging to \fB\fCnimsuggest.log\fR file
.PP
\fB\fC\-\-v1\fR
use version 1 of the protocol; for backwards compatibility
.PP
\fB\fC\-\-refresh\fR
perform automatic refreshes to keep the analysis precise
.PP
\fB\fC\-\-maxresults\fR:\fIN\fP
limit the number of suggestions to N
.PP
\fB\fC\-\-tester\fR
implies \fB\fC\-\-stdin\fR and outputs a line \fB\fC\&'!EOF!'\fR for the tester
.SH SEE ALSO
.PP
.BR nim (1),
Official documentation \[la]https://nim-lang.org/docs/nimsuggest.html\[ra]
-13
View File
@@ -1,13 +0,0 @@
if filters.contains("nightly") {
rpm.global("commit", gh_commit("nim-lang/Nim"));
if rpm.changed() {
let comp = get("https://raw.githubusercontent.com/nim-lang/Nim/devel/lib/system/compilation.nim");
let maj = find("\\n\\s*NimMajor.+=\\s*(\\d+)\\n", comp, 1);
let min = find("\\n\\s*NimMinor.+=\\s*(\\d+)\\n", comp, 1);
let pat = find("\\n\\s*NimPatch.+=\\s*(\\d+)\\n", comp, 1);
let v = `${maj}.${min}.${pat}`;
rpm.global("ver", v);
rpm.release();
rpm.global("commit_date", date());
}
}
-5
View File
@@ -1,5 +0,0 @@
project pkg {
rpm {
spec = "nim.spec"
}
}
-649
View File
@@ -1,649 +0,0 @@
.TH NIM 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nim \- Nim compiler
.SH SYNOPSIS
.PP
\fB\fCnim\fR \fB\fCcommand\fR [\fIoptions\fP] [\fIprojectfile\fP] [\fIarguments\fP]
.SH COMMANDS
.PP
Basic commands
.PP
\fB\fCcompile\fR, \fB\fCc\fR
compile project with default code generator (C)
.PP
\fB\fCdoc\fR
generate the documentation for inputfile
.PP
\fB\fCdoc2\fR
generate the documentation for the whole project
.SH OPTIONS
.PP
\fB\fC\-p\fR, \fB\fC\-\-path\fR:\fIPATH\fP
add path to search paths
.PP
\fB\fC\-d\fR, \fB\fC\-\-define\fR:\fISYMBOL\fP(:\fIVAL\fP)
define a conditional symbol (optionally: define the value for that symbol)
.PP
\fB\fC\-u\fR, \fB\fC\-\-undef\fR:\fISYMBOL\fP
undefine a conditional symbol
.PP
\fB\fC\-f\fR, \fB\fC\-\-forceBuild\fR
force rebuilding of all modules
.PP
\fB\fC\-\-stackTrace\fR:\fIon\fP|\fIoff\fP
turn stack tracing on|off
.PP
\fB\fC\-\-lineTrace\fR:\fIon\fP|\fIoff\fP
turn line tracing on|off
.PP
\fB\fC\-\-threads\fR:\fIon\fP|\fIoff\fP
turn support for multi\-threading on|off
.PP
\fB\fC\-x\fR, \fB\fC\-\-checks\fR:\fIon\fP|\fIoff\fP
turn all runtime checks on|off
.PP
\fB\fC\-\-objChecks\fR:\fIon\fP|\fIoff\fP
turn obj conversion checks on|off
.PP
\fB\fC\-\-fieldChecks\fR:\fIon\fP|\fIoff\fP
turn case variant field checks on|off
.PP
\fB\fC\-\-rangeChecks\fR:\fIon\fP|\fIoff\fP
turn range checks on|off
.PP
\fB\fC\-\-boundChecks\fR:\fIon\fP|\fIoff\fP
turn bound checks on|off
.PP
\fB\fC\-\-overflowChecks\fR:\fIon\fP|\fIoff\fP
turn int over\-/underflow checks on|off
.PP
\fB\fC\-a\fR, \fB\fC\-\-assertions\fR:\fIon\fP|\fIoff\fP
turn assertions on|off
.PP
\fB\fC\-\-floatChecks\fR:\fIon\fP|\fIoff\fP
turn all floating point (NaN/Inf) checks on|off
.PP
\fB\fC\-\-nanChecks\fR:\fIon\fP|\fIoff\fP
turn NaN checks on|off
.PP
\fB\fC\-\-infChecks\fR:\fIon\fP|\fIoff\fP
turn Inf checks on|off
.PP
\fB\fC\-\-deadCodeElim\fR:\fIon\fP|\fIoff\fP
whole program dead code elimination on|off
.PP
\fB\fC\-\-opt\fR:\fInone\fP|\fIspeed|size\fP
optimize not at all or for speed|size. Note: use \fB\fC\-d:release\fR for a release build!
.PP
\fB\fC\-\-debugger\fR:native|endb*
use native debugger (gdb) | ENDB (experimental)
.PP
\fB\fC\-\-app\fR:\fIconsole\fP|\fIgui\fP|\fIlib\fP|\fIstaticlib\fP
generate a console app, GUI app, DLL, or static library
.PP
\fB\fC\-r\fR, \fB\fC\-\-run\fR
run the compiled program with given arguments
.PP
\fB\fC\-\-advanced\fR
show advanced command line switches
.PP
\fB\fC\-h\fR, \fB\fC\-\-help\fR
show this help
.SH ADVANCED COMMANDS
.PP
\fB\fCcompileToC\fR, \fB\fCcc\fR
compile project with C code generator
.PP
\fB\fCcompileToCpp\fR, \fB\fCcpp\fR
compile project to C++ code
.PP
\fB\fCcompileToOC\fR, \fB\fCobjc\fR
compile project to Objective C code
.PP
\fB\fCjs\fR
compile project to Javascript
.PP
\fB\fCe\fR
run a Nimscript file
.PP
\fB\fCrst2html\fR
convert a reStructuredText file to HTML
.PP
\fB\fCrst2tex\fR
convert a reStructuredText file to TeX
.PP
\fB\fCjsondoc\fR
extract the documentation to a json file
.PP
\fB\fCjsondoc2\fR
extract documentation to a json file (uses doc2)
.PP
\fB\fCbuildIndex\fR
build an index for the whole documentation
.PP
\fB\fCrun\fR
run the project (with Tiny C backend; buggy!)
.PP
\fB\fCgenDepend\fR
generate a DOT file containing the module dependency graph
.PP
\fB\fCdump\fR
dump all defined conditionals and search paths
.PP
\fB\fCcheck\fR
checks the project for syntax and semantic
.SH ADVANCED OPTIONS
.PP
\fB\fC\-o\fR:\fIFILE\fP, \fB\fC\-\-out\fR:\fIFILE\fP
set the output filename
.PP
\fB\fC\-\-stdout\fR
output to stdout
.PP
\fB\fC\-\-colors\fR:\fIon\fP|\fIoff\fP
turn compiler messages coloring on|off
.PP
\fB\fC\-\-listFullPaths\fR
list full paths in messages
.PP
\fB\fC\-w\fR:\fIon\fP|\fIoff\fP|\fIlist\fP, \fB\fC\-\-warnings\fR:\fIon\fP|\fIoff\fP|\fIlist\fP
turn all warnings on|off or list all available
.PP
\fB\fC\-\-warning[X]\fR:\fIon\fP|\fIoff\fP
turn specific warning X on|off
.PP
\fB\fC\-\-hints\fR:\fIon\fP|\fIoff\fP|\fIlist\fP
turn all hints on|off or list all available
.PP
\fB\fC\-\-hint[X]\fR:\fIon\fP|\fIoff\fP
turn specific hint X on|off
.PP
\fB\fC\-\-lib\fR:\fIPATH\fP
set the system library path
.PP
\fB\fC\-\-import\fR:\fIPATH\fP
add an automatically imported module
.PP
\fB\fC\-\-include\fR:\fIPATH\fP
add an automatically included module
.PP
\fB\fC\-\-nimcache\fR:\fIPATH\fP
set the path used for generated files
.PP
\fB\fC\-\-header\fR:\fIFILE\fP
the compiler should produce a .h file (FILE is optional)
.PP
\fB\fC\-c\fR, \fB\fC\-\-compileOnly\fR
compile only; do not assemble or link
.PP
\fB\fC\-\-noLinking\fR
compile but do not link
.PP
\fB\fC\-\-noMain\fR
do not generate a main procedure
.PP
\fB\fC\-\-genScript\fR
generate a compile script (in the 'nimcache' subdirectory named 'compile_$project$scriptext')
.PP
\fB\fC\-\-os\fR:\fISYMBOL\fP
set the target operating system (cross\-compilation)
.PP
\fB\fC\-\-cpu\fR:\fISYMBOL\fP
set the target processor (cross\-compilation)
.PP
\fB\fC\-\-debuginfo\fR
enables debug information
.PP
\fB\fC\-t\fR, \fB\fC\-\-passC\fR:\fIOPTION\fP
pass an option to the C compiler
.PP
\fB\fC\-l\fR, \fB\fC\-\-passL\fR:\fIOPTION\fP
pass an option to the linker
.PP
\fB\fC\-\-cincludes\fR:\fIDIR\fP
modify the C compiler header search path
.PP
\fB\fC\-\-clibdir\fR:\fIDIR\fP
modify the linker library search path
.PP
\fB\fC\-\-clib\fR:\fILIBNAME\fP
link an additional C library (you should omit platform\-specific extensions)
.PP
\fB\fC\-\-genMapping\fR
generate a mapping file containing (Nim, mangled) identifier pairs
.PP
\fB\fC\-\-project\fR
document the whole project (doc2)
.PP
\fB\fC\-\-docSeeSrcUrl\fR:\fIurl\fP
activate 'see source' for doc and doc2 commands (see doc.item.seesrc in config/nimdoc.cfg)
.PP
\fB\fC\-\-lineDir\fR:\fIon\fP|\fIoff\fP
generation of #line directive on|off
.PP
\fB\fC\-\-embedsrc\fR
embeds the original source code as comments in the generated output
.PP
\fB\fC\-\-threadanalysis\fR:\fIon\fP|\fIoff\fP
turn thread analysis on|off
.PP
\fB\fC\-\-tlsEmulation\fR:\fIon\fP|\fIoff\fP
turn thread local storage emulation on|off
.PP
\fB\fC\-\-taintMode\fR:\fIon\fP|\fIoff\fP
turn taint mode on|off
.PP
\fB\fC\-\-implicitStatic\fR:\fIon\fP|\fIoff\fP
turn implicit compile time evaluation on|off
.PP
\fB\fC\-\-patterns\fR:\fIon\fP|\fIoff\fP
turn pattern matching on|off
.PP
\fB\fC\-\-memTracker\fR:\fIon\fP|\fIoff\fP
turn memory tracker on|off
.PP
\fB\fC\-\-excessiveStackTrace\fR:\fIon\fP|\fIoff\fP
stack traces use full file paths
.PP
\fB\fC\-\-skipCfg\fR
do not read the general configuration file
.PP
\fB\fC\-\-skipUserCfg\fR
do not read the user's configuration file
.PP
\fB\fC\-\-skipParentCfg\fR
do not read the parent dirs' configuration files
.PP
\fB\fC\-\-skipProjCfg\fR
do not read the project's configuration file
.PP
\fB\fC\-\-gc\fR:\fIrefc\fP|\fIv2\fP|\fImarkAndSweep\fP|\fIboehm\fP|\fIgo|none\fP|\fIregions\fP
select the GC to use; default is \fB\fCrefc\fR
.PP
\fB\fC\-\-index\fR:\fIon\fP|\fIoff\fP
turn index file generation on|off
.PP
\fB\fC\-\-putenv\fR:\fIkey\fP=\fIvalue\fP
set an environment variable
.PP
\fB\fC\-\-NimblePath\fR:\fIPATH\fP
add a path for Nimble support
.PP
\fB\fC\-\-noNimblePath\fR
deactivate the Nimble path
.PP
\fB\fC\-\-noCppExceptions\fR
use default exception handling with C++ backend
.PP
\fB\fC\-\-excludePath\fR:\fIPATH\fP
exclude a path from the list of search paths
.PP
\fB\fC\-\-dynlibOverride\fR:\fISYMBOL\fP
marks SYMBOL so that dynlib:SYMBOL has no effect and can be statically linked instead; symbol matching is fuzzy so that \fB\fC\-\-dynlibOverride:lua\fR matches dynlib: "liblua.so.3"
.PP
\fB\fC\-\-listCmd\fR
list the commands used to execute external programs
.PP
\fB\fC\-\-parallelBuild\fR:\fI0\fP|\fI1\fP|\fI\&...\fP
perform a parallel build value = number of processors (0 for auto\-detect)
.PP
\fB\fC\-\-verbosity\fR:\fI0\fP|\fI1\fP|\fI2\fP|\fI3\fP
set Nim's verbosity level (1 is default)
.PP
\fB\fC\-\-experimental\fR
enable experimental language features
.PP
\fB\fC\-v\fR, \fB\fC\-\-version\fR
show detailed version information
.SH LIST OF WARNINGS
.PP
Each warning can be activated individually with \fB\fC\-\-warning[NAME]\fR:\fIon\fP|\fIoff\fP or in a \fB\fCpush\fR pragma.
.TS
allbox;
cb cb
l l
l l
l l
l l
l l
l l
l l
l l
.
Name Description
CannotOpenFile Some file not essential for the compiler's working could not be opened.
OctalEscape The code contains an unsupported octal sequence.
Deprecated The code uses a deprecated symbol.
ConfigDeprecated The project makes use of a deprecated config file.
SmallLshouldNotBeUsed The letter 'l' should not be used as an identifier.
EachIdentIsTuple The code contains a confusing var declaration.
ShadowIdent A local variable shadows another local variable of an outer scope.
User Some user defined warning.
.TE
.SH VERBOSITY LEVELS
.PP
\fB\fC0\fR:
Minimal output level for the compiler.
.PP
\fB\fC1\fR:
Displays compilation of all the compiled files, including those imported by other modules or through the compile pragma \[la]https://nim-lang.org/docs/nimc.html#compile-pragma\[ra]\&. This is the default level.
.PP
\fB\fC2\fR:
Displays compilation statistics, enumerates the dynamic libraries that will be loaded by the final binary and dumps to standard output the result of applying a filter to the source code \[la]https://nim-lang.org/docs/filters.html\[ra] if any filter was used during compilation.
.PP
\fB\fC3\fR:
In addition to the previous levels dumps a debug stack trace for compiler developers.
.SH COMPILE TIME SYMBOLS
.PP
Through the \fB\fC\-d\fR:\fIx\fP or \fB\fC\-\-define\fR:\fIx\fP switch you can define compile time symbols for conditional compilation. The defined switches can be checked in source code with the when statement and defined proc. The typical use of this switch is to enable builds in release mode (\fB\fC\-d:release\fR) where certain safety checks are omitted for better performance. Another common use is the \fB\fC\-d:ssl\fR switch to activate SSL sockets.
.PP
Additionally, you may pass a value along with the symbol: \fB\fC\-d\fR:\fIx=y\fP which may be used in conjunction with the compile time define pragmas to override symbols during build time.
.SH CONFIGURATION FILES
.PP
\fINote\fP: The project file name is the name of the \fB\fC\&.nim\fR file that is passed as a command line argument to the compiler.
.PP
The \fB\fCnim\fR executable processes configuration files in the following directories (in this order; later files overwrite previous settings):
.nr step0 0 1
.RS
.IP \n+[step0]
\fB\fC$nim/config/nim.cfg\fR, \fB\fC/etc/nim.cfg\fR (UNIX) or \fB\fC%NIMROD%/config/nim.cfg\fR (Windows). This file can be skipped with the \-\-skipCfg command line option.
.IP \n+[step0]
\fB\fC/home/$user/.config/nim.cfg\fR (UNIX) or \fB\fC%APPDATA%/nim.cfg\fR (Windows). This file can be skipped with the \fB\fC\-\-skipUserCfg\fR command line option.
.IP \n+[step0]
\fB\fC$parentDir/nim.cfg\fR where \fB\fC$parentDir\fR stands for any parent directory of the project file's path. These files can be skipped with the \fB\fC\-\-skipParentCfg\fR command line option.
.IP \n+[step0]
\fB\fC$projectDir/nim.cfg\fR where \fB\fC$projectDir\fR stands for the project file's path. This file can be skipped with the \fB\fC\-\-skipProjCfg\fR command line option.
.IP \n+[step0]
A project can also have a project specific configuration file named \fB\fC$project.nim.cfg\fR that resides in the same directory as \fB\fC$project.nim\fR\&. This file can be skipped with the \fB\fC\-\-skipProjCfg\fR command line option.
Command line settings have priority over configuration file settings.
.RE
.PP
The default build of a project is a debug build. To compile a release build define the \fB\fCrelease\fR symbol:
.PP
.RS
.nf
nim c \-d:release myproject.nim
.fi
.RE
.SH SEARCH PATH HANDLING
.PP
Nim has the concept of a global search path (PATH) that is queried to determine where to find imported modules or include files. If multiple files are found an ambiguity error is produced.
.PP
\fB\fCnim dump\fR shows the contents of the PATH.
.PP
However before the PATH is used the current directory is checked for the file's existence. So if PATH contains $lib and $lib/bar and the directory structure looks like this:
.PP
.RS
.nf
$lib/x.nim
$lib/bar/x.nim
foo/x.nim
foo/main.nim
other.nim
.fi
.RE
.PP
And \fB\fCmain\fR imports \fB\fCx\fR, \fB\fCfoo/x\fR is imported. If \fB\fCother\fR imports \fB\fCx\fR then both \fB\fC$lib/x.nim\fR and \fB\fC$lib/bar/x.nim\fR match and so the compiler should reject it. Currently however this check is not implemented and instead the first matching file is used.
.SH GENERATED C CODE DIRECTORY
.PP
The generated files that Nim produces all go into a subdirectory called \fB\fCnimcache\fR in your project directory. This makes it easy to delete all generated files. Files generated in this directory follow a naming logic which you can read about in the Nim Backend Integration document \[la]https://nim-lang.org/docs/backends.html#nimcache-naming-logic\[ra]\&.
.PP
However, the generated C code is not platform independent. C code generated for Linux does not compile on Windows, for instance. The comment on top of the C file lists the OS, CPU and CC the file has been compiled for.
.SH COMPILATION CACHE
.PP
\fIWarning\fP: The compilation cache is still highly experimental!
.PP
The \fB\fCnimcache\fR directory may also contain so called rod or symbol files. These files are pre\-compiled modules that are used by the compiler to perform incremental compilation. This means that only modules that have changed since the last compilation (or the modules depending on them etc.) are re\-compiled. However, per default no symbol files are generated; use the \fB\fC\-\-symbolFiles:on\fR command line switch to activate them.
.PP
Unfortunately due to technical reasons the \fB\fC\-\-symbolFiles:on\fR needs to aggregate some generated C code. This means that the resulting executable might contain some cruft even when dead code elimination is turned on. So the final release build should be done with \fB\fC\-\-symbolFiles:off\fR\&.
.PP
Due to the aggregation of C code it is also recommended that each project resides in its own directory so that the generated \fB\fCnimcache\fR directory is not shared between different projects.
.SH COMPILER SELECTION
.PP
To change the compiler from the default compiler (at the command line):
.PP
.RS
.nf
nim c \-\-cc:llvm_gcc \-\-compile_only myfile.nim
.fi
.RE
.PP
This uses the configuration defined in \fB\fCconfig\\nim.cfg\fR for \fB\fCllvm_gcc\fR\&.
.PP
If \fB\fCnimcache\fR already contains compiled code from a different compiler for the same project, add the \fB\fC\-f\fR flag to force all files to be recompiled.
.PP
The default compiler is defined at the top of \fB\fCconfig\\nim.cfg\fR\&. Changing this setting affects the compiler used by \fB\fCkoch\fR to (re)build Nim.
.SH CROSS COMPILATION
.PP
To cross compile, use for example:
.PP
.RS
.nf
nim c \-\-cpu:i386 \-\-os:linux \-\-compileOnly \-\-genScript myproject.nim
.fi
.RE
.PP
Then move the C code and the compile script \fB\fCcompile_myproject.sh\fR to your Linux i386 machine and run the script.
.PP
Another way is to make Nim invoke a cross compiler toolchain:
.PP
.RS
.nf
nim c \-\-cpu:arm \-\-os:linux myproject.nim
.fi
.RE
.PP
For cross compilation, the compiler invokes a C compiler named like \fB\fC$cpu.$os.$cc\fR (for example \fB\fCarm.linux.gcc\fR) and the configuration system is used to provide meaningful defaults. For example for \fIARM\fP your configuration file should contain something like:
.PP
.RS
.nf
arm.linux.gcc.path = "/usr/bin"
arm.linux.gcc.exe = "arm\-linux\-gcc"
arm.linux.gcc.linkerexe = "arm\-linux\-gcc"
.fi
.RE
.PP
DLL GENERATION
.PP
Nim supports the generation of DLLs. However, there must be only one instance of the GC per process/address space. This instance is contained in \fB\fCnimrtl.dll\fR\&. This means that every generated Nim DLL depends on \fB\fCnimrtl.dll\fR\&. To generate the "nimrtl.dll" file, use the command:
.PP
.RS
.nf
nim c \-d:release lib/nimrtl.nim
.fi
.RE
.PP
To link against nimrtl.dll use the command:
.PP
.RS
.nf
nim c \-d:useNimRtl myprog.nim
.fi
.RE
.PP
\fINote\fP: Currently the creation of \fB\fCnimrtl.dll\fR with thread support has never been tested and is unlikely to work!
.SH ADDITIONAL COMPILATION SWITCHES
.PP
The standard library supports a growing number of \fB\fCuseX\fR conditional defines affecting how some features are implemented. This section tries to give a complete list.
.PP
\fB\fC\-d:release\fR
Turns off runtime checks and turns on the optimizer.
.PP
\fB\fC\-d:useWinAnsi\fR
Modules like \fB\fCos\fR and \fB\fCosproc\fR use the ANSI versions of the Windows API. The default build uses the Unicode version.
.PP
\fB\fC\-d:useFork\fR
Makes \fB\fCosproc\fR use \fB\fCfork\fR instead of \fB\fCposix_spawn\fR\&.
.PP
\fB\fC\-d:useNimRtl\fR
Compile and link against \fB\fCnimrtl.dll\fR\&.
.PP
\fB\fC\-d:useMalloc\fR
Makes Nim use C's malloc instead of Nim's own memory manager, ableit prefixing each allocation with its size to support clearing memory on reallocation. This only works with \fB\fCgc:none\fR\&.
.PP
\fB\fC\-d:useRealtimeGC\fR
Enables support of Nim's GC for soft realtime systems. See the documentation of the gc \[la]https://nim-lang.org/docs/gc.html\[ra] for further information.
.PP
\fB\fC\-d:nodejs\fR
The JS target is actually \fB\fCnode.js\fR\&.
.PP
\fB\fC\-d:ssl\fR
Enables OpenSSL support for the sockets module.
.PP
\fB\fC\-d:memProfiler\fR
Enables memory profiling for the native GC.
.PP
\fB\fC\-d:uClibc\fR
Use uClibc instead of libc. (Relevant for Unix\-like OSes)
.PP
\fB\fC\-d:checkAbi\fR
When using types from C headers, add checks that compare what's in the Nim file with what's in the C header (requires a C compiler with \fIStatic\fPassert support, like any C11 compiler)
.PP
\fB\fC\-d:tempDir\fR:\fIPATH\fP
This symbol takes a string as its value, like \fB\fC\-\-define:tempDir:/some/temp/path\fR to override the temporary directory returned by \fB\fCos.getTempDir()\fR\&. The value should end with a directory separator character. (Relevant for the Android platform)
.PP
\fB\fC\-d:useShPath\fR:\fIPATH\fP
This symbol takes a string as its value, like \fB\fC\-\-define:useShPath:/opt/sh/bin/sh\fR to override the path for the \fB\fCsh\fR binary, in cases where it is not located in the default location \fB\fC/bin/sh\fR\&.
.SH ADDITIONAL FEATURES
.PP
This section describes Nim's additional features that are not listed in the Nim manual. Some of the features here only make sense for the C code generator and are subject to change.
.PP
\fILineDir option\fP
The \fB\fClineDir\fR option can be turned on or off. If turned on the generated C code contains \fB\fC#line\fR directives. This may be helpful for debugging with GDB.
.PP
\fIStackTrace option\fP
If the \fB\fCstackTrace\fR option is turned on, the generated C contains code to ensure that proper stack traces are given if the program crashes or an uncaught exception is raised.
.PP
\fILineTrace option\fP
The \fB\fClineTrace\fR option implies the \fB\fCstackTrace\fR option. If turned on, the generated C contains code to ensure that proper stack traces with line number information are given if the program crashes or an uncaught exception is raised.
.PP
\fIDebugger option\fP
The \fB\fCdebugger\fR option enables or disables the \fIEmbedded Nim Debugger\fP\&. See the documentation of endb \[la]https://nim-lang.org/docs/endb.html\[ra] for further information.
.PP
\fIBreakpoint pragma\fP
The breakpoint pragma was specially added for the sake of debugging with ENDB. See the documentation of endb \[la]https://nim-lang.org/docs/endb.html\[ra] for further information.
.SH DynlibOverride
.PP
By default Nim's \fB\fCdynlib\fR pragma causes the compiler to generate \fB\fCGetProcAddress\fR (or their Unix counterparts) calls to bind to a DLL. With the \fB\fCdynlibOverride\fR command line switch this can be prevented and then via \fB\fC\-\-passL\fR the static library can be linked against. For instance, to link statically against Lua this command might work on Linux:
.PP
.RS
.nf
nim c \-\-dynlibOverride:lua \-\-passL:liblua.lib program.nim
.fi
.RE
.SH BACKEND LANGUAGE OPTIONS
.PP
The typical compiler usage involves using the \fB\fCcompile\fR or \fB\fCc\fR command to transform a \fB\fC\&.nim\fR file into one or more \fB\fC\&.c\fR files which are then compiled with the platform's C compiler into a static binary. However there are other commands to compile to C++, Objective\-C or Javascript. More details can be read in the Nim Backend Integration document \[la]https://nim-lang.org/docs/backends.html\[ra]\&.
.SH NIM DOCUMENTATION TOOLS
.PP
Nim provides the \fB\fCdoc\fR and \fB\fCdoc2\fR commands to generate HTML documentation from \fB\fC\&.nim\fR source files. Only exported symbols will appear in the output. For more details see the docgen documentation \[la]https://nim-lang.org/docs/docgen.html\[ra]\&.
.SH NIM IDETOOLS INTEGRATION
.PP
Nim provides language integration with external IDEs through the \fB\fCidetools\fR command. See the documentation of idetools \[la]https://nim-lang.org/docs/idetools.html\[ra] for further information.
.SH NIM FOR EMBEDDED SYSTEMS
.PP
The standard library can be avoided to a point where C code generation for 16bit micro controllers is feasible. Use the standalone target (\fB\fC\-\-os:standalone\fR) for a bare bones standard library that lacks any OS features.
.PP
To make the compiler output code for a 16bit target use the \fB\fC\-\-cpu:avr\fR target.
.PP
For example, to generate code for an AVR processor use this command:
.PP
.RS
.nf
nim c \-\-cpu:avr \-\-os:standalone \-\-deadCodeElim:on \-\-genScript x.nim
.fi
.RE
.PP
For the \fB\fCstandalone\fR target one needs to provide a file \fB\fCpanicoverride.nim\fR\&. See \fB\fCtests/manyloc/standalone/panicoverride.nim\fR for an example implementation. Additionally, users should specify the amount of heap space to use with the \fB\fC\-d:StandaloneHeapSize\fR=\fISIZE\fP command line switch. Note that the total heap size will be \fB\fCSIZE * sizeof(float64)\fR\&.
.SH NIM FOR REALTIME SYSTEMS
.PP
See the documentation of Nim's soft realtime GC \[la]https://nim-lang.org/docs/gc.html\[ra] for further information.
.SH DEBUGGING WITH NIM
.PP
Nim comes with its own \fIEmbedded Nim Debugger\fP\&. See the documentation of endb \[la]https://nim-lang.org/docs/endb.html\[ra] for further information.
.SH OPTIMIZING FOR NIM
.PP
Nim has no separate optimizer, but the C code that is produced is very efficient. Most C compilers have excellent optimizers, so usually it is not needed to optimize one's code. Nim has been designed to encourage efficient code: The most readable code in Nim is often the most efficient too.
.PP
However, sometimes one has to optimize. Do it in the following order:
.nr step1 0 1
.RS
.IP \n+[step1]
switch off the embedded debugger (it is slow!)
.IP \n+[step1]
turn on the optimizer and turn off runtime checks
.IP \n+[step1]
profile your code to find where the bottlenecks are
.IP \n+[step1]
try to find a better algorithm
.IP \n+[step1]
do low\-level optimizations
.RE
.PP
This section can only help you with the last item.
.PP
\fIOptimizing string handling\fP
.PP
String assignments are sometimes expensive in Nim: They are required to copy the whole string. However, the compiler is often smart enough to not copy strings. Due to the argument passing semantics, strings are never copied when passed to subroutines. The compiler does not copy strings that are a result from a procedure call, because the callee returns a new string anyway. Thus it is efficient to do:
.PP
.RS
.nf
var s = procA() # assignment will not copy the string; procA allocates a new
# string already
.fi
.RE
.PP
However it is not efficient to do:
.PP
.RS
.nf
var s = varA # assignment has to copy the whole string into a new buffer!
.fi
.RE
.PP
For \fB\fClet\fR symbols a copy is not always necessary:
.PP
.RS
.nf
let s = varA # may only copy a pointer if it safe to do so
.fi
.RE
.PP
If you know what you're doing, you can also mark single string (or sequence) objects as shallow:
.PP
.RS
.nf
var s = "abc"
shallow(s) # mark 's' as shallow string
var x = s # now might not copy the string!
.fi
.RE
.PP
Usage of \fB\fCshallow\fR is always safe once you know the string won't be modified anymore, similar to Ruby's freeze.
.PP
The compiler optimizes string case statements: A hashing scheme is used for them if several different string constants are used. So code like this is reasonably efficient:
.PP
.RS
.nf
case normalize(k.key)
of "name": c.name = v
of "displayname": c.displayName = v
of "version": c.version = v
of "os": c.oses = split(v, {';'})
of "cpu": c.cpus = split(v, {';'})
of "authors": c.authors = split(v, {';'})
of "description": c.description = v
of "app":
case normalize(v)
of "console": c.app = appConsole
of "gui": c.app = appGUI
else: quit(errorStr(p, "expected: console or gui"))
of "license": c.license = UnixToNativePath(k.value)
else: quit(errorStr(p, "unknown variable: " & k.key))
.fi
.RE
.SH SEE ALSO
.PP
Official documentation \[la]https://nim-lang.org/documentation.html\[ra],
.BR nimgrep (1)
-162
View File
@@ -1,162 +0,0 @@
%global csrc_commit 561b417c65791cd8356b5f73620914ceff845d10
%global debug_package %{nil}
Name: nim
Version: 2.2.2
Release: 1%?dist
Summary: Imperative, multi-paradigm, compiled programming language
License: MIT and BSD
URL: https://nim-lang.org
Source1: nim.1
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 anda-srpm-macros
Requires: gcc
%description
Nim is a compiled, garbage-collected systems programming language with a
design that focuses on efficiency, expressiveness, and elegance (in that
order of priority).
%package tools
Summary: Tools for Nim programming language
%description tools
Nim is a compiled, garbage-collected systems programming language with a
design that focuses on efficiency, expressiveness, and elegance (in that
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
%description doc
Nim is a compiled, garbage-collected systems programming language with a
design that focuses on efficiency, expressiveness, and elegance (in that
order of priority).
This package provides documentation and reference manual for the language
and its standard library.
%endif
%prep
%git_clone https://github.com/nim-lang/Nim v%version
%build
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}"
. ci/funs.sh
nimBuildCsourcesIfNeeded CFLAGS="${CFLAGS} -Ic_code -w -O3 -fno-strict-aliasing -fPIE" LDFLAGS="-ldl -lm -lrt -pie"
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:createNimRtl -d:release nimrtl.nim) &
koch tools -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 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
bin/nim cc -d:nimCallDepthLimit=10000 -r tools/niminst/niminst --var:version=%ver --var:mingw=none scripts compiler/installer.ini
sh ./install.sh %buildroot/usr/bin
mkdir -p %buildroot/%_bindir %buildroot/%_datadir/bash-completion/completions %buildroot/usr/lib/nim %buildroot%_datadir
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
mv %buildroot%_bindir/nim %buildroot%_datadir/
ln -s %_datadir/nim/bin/nim %buildroot%_bindir/nim
%ifarch x86_64
mkdir -p %buildroot/%_docdir/%name/html || true
cp -a doc/html/*.html %buildroot/%_docdir/%name/html/ || true
cp tools/dochack/dochack.js %buildroot/%_docdir/%name/ || true
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
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 %_prefix/lib/nim %buildroot%_prefix/lib/nim/lib # compiler needs lib from here
#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
%doc doc/readme.txt
%_sysconfdir/nim/
%_bindir/atlas
%_bindir/nim_dbg
%_bindir/nim-gdb
%_bindir/testament
%_bindir/nim
%_bindir/nimble
%_bindir/nim_csources_*
%_mandir/man1/nim.1*
%_mandir/man1/nimble.1*
%_prefix/lib/nim/
%_prefix/lib/libnimrtl.so
%_includedir/cycle.h
%_includedir/nimbase.h
%_datadir/nim
%bash_completions_dir/nim
%bash_completions_dir/nimble
%files tools
%license copying.txt
%_bindir/nimgrep
%_bindir/nimsuggest
%_bindir/nimpretty
%_mandir/man1/nimgrep.1*
%_mandir/man1/nimsuggest.1*
%ifarch x86_64
%files doc
%doc %_docdir/nim
%endif
%changelog
%autochangelog
-97
View File
@@ -1,97 +0,0 @@
.TH NIMBLE 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nimble \- package manager for the Nim programming language.
.SH SYNOPSIS
.PP
\fB\fCnimble\fR \fIcommand\fP [\fIcommand\-options\fP]
.SH COMMANDS
.PP
\fB\fCinstall\fR [\fB\fC\-d\fR, \fB\fC\-\-depsOnly\fR] [\fIpkgname\fP, \fI\&...\fP]
Install a list of packages (\fB\fC\-d\fR switch for only dependencies).
.PP
\fB\fCdevelop\fR [\fIpkgname\fP, \fI\&...\fP]
Clone a list of packages for development. Symlinks the cloned packages or any package in the current working directory.
.PP
\fB\fCcheck\fR
Verify the validity of a package in the current working directory.
.PP
\fB\fCinit\fR [\fIpkgname\fP]
Initialize a new Nimble project.
.PP
\fB\fCpublish\fR
Publish a package on nim\-lang/packages. The current working directory needs to be the toplevel directory of the Nimble package.
.PP
\fB\fCuninstall\fR [\fIpkgname\fP, \fI\&...\fP]
Uninstall a list of packages.
.PP
\fB\fCbuild\fR
Build a package.
.PP
\fB\fCc\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build a file inside a package using \fB\fCC\fR backend.
.PP
\fB\fCcc\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build a file inside a package using \fB\fCC++\fR backend.
.PP
\fB\fCjs\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build a file inside a package using \fB\fCJavascript\fR backend.
.PP
\fB\fCtest\fR
Compile and execute tests
.PP
\fB\fCdoc\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build documentation for a file inside a package.
.PP
\fB\fCdoc2\fR [\fIoptions\fP, \fI\&...\fP] \fIfile.nim\fP
Build documentation with semantic checking for a file inside a package.
.PP
\fB\fCrefresh\fR [\fIurl\fP]
Refresh the package list. A package list URL can be optionally specified.
.PP
\fB\fCsearch\fR [\fB\fC\-\-ver\fR] \fIpkg\fP/\fItag\fP
Search for a specified package by tag and by name. With \fB\fC\-\-ver\fR remote server will be asked for package versions.
.PP
\fB\fClist\fR [\fB\fC\-\-ver\fR]
List all packages. With \fB\fC\-\-ver\fR remote server will be asked for package versions. With \fB\fC\-i\fR results will be limited to locally installed packages.
.PP
\fB\fCtasks\fR
List the tasks specified in the Nimble package's Nimble file.
.PP
\fB\fCpath\fR \fIpkgname\fP \fI\&...\fP
Shows absolute path to the installed packages specified.
.PP
\fB\fCdump\fR [\fIpkgname\fP]
Outputs Nimble package information for external tools. The argument can be a .nimble file, a project directory or the name of an installed package.
.SH OPTIONS
.PP
\fB\fC\-h\fR, \fB\fC\-\-help\fR
Print this help message.
.PP
\fB\fC\-v\fR, \fB\fC\-\-version\fR
Print version information.
.PP
\fB\fC\-y\fR, \fB\fC\-\-accept\fR
Accept all interactive prompts.
.PP
\fB\fC\-n\fR, \fB\fC\-\-reject\fR
Reject all interactive prompts.
.PP
\fB\fC\-\-ver\fR
Query remote server for package version information when searching or listing packages
.PP
\fB\fC\-\-nimbleDir\fR:\fIdirname\fP
Set the Nimble directory.
.PP
\fB\fC\-\-verbose\fR
Show all non\-debug output.
.PP
\fB\fC\-\-debug\fR
Show all output including debug messages.
.PP
\fB\fC\-\-noColor\fR
Don't colorise output.
.SH SEE ALSO
.PP
.BR nim (1),
README \[la]https://github.com/nim-lang/nimble#readme\[ra]
-60
View File
@@ -1,60 +0,0 @@
.TH NIMGREP 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nimgrep \- search and replace strings matching pattern
.SH SYNOPSIS
.PP
\fB\fCnimgrep\fR [\fIoptions\fP] [\fIpattern\fP] [\fIreplacement\fP] [\fIFILE\fP/\fIDIRECTORY\fP\&...]
.SH DESCRIPTION
.PP
Nimgrep is a command line tool for search&replace tasks. It can search for regex or peg patterns and can search whole directories at once. User confirmation for every single replace operation can be requested.
.PP
Nimgrep has particularly good support for Nim's eccentric \fIstyle insensitivity\fP\&. Apart from that it is a generic text manipulation tool.
.SH OPTIONS
.PP
\fB\fC\-\-find\fR, \fB\fC\-f\fR
find the pattern (default)
.PP
\fB\fC\-\-replace\fR, \fB\fC\-r\fR
replace the pattern
.PP
\fB\fC\-\-peg\fR
pattern is a peg
.PP
\fB\fC\-\-re\fR
pattern is a regular expression (default); extended syntax for the regular expression is always turned on
.PP
\fB\fC\-\-recursive\fR
process directories recursively
.PP
\fB\fC\-\-confirm\fR
confirm each occurrence/replacement; there is a chance to abort any time without touching the file
.PP
\fB\fC\-\-stdin\fR
read pattern from stdin (to avoid the shell's confusing quoting rules)
.PP
\fB\fC\-\-word\fR, \fB\fC\-w\fR
the match should have word boundaries (buggy for pegs!)
.PP
\fB\fC\-\-ignoreCase\fR, \fB\fC\-i\fR
be case insensitive
.PP
\fB\fC\-\-ignoreStyle\fR, \fB\fC\-y\fR
be style insensitive
.PP
\fB\fC\-\-ext\fR:\fIEX1\fP|\fIEX2\fP|\fI\&...\fP
only search the files with the given
.BR extension (s)
.PP
\fB\fC\-\-verbose\fR
be verbose: list every processed file
.PP
\fB\fC\-\-help\fR, \fB\fC\-h\fR
shows this help
.PP
\fB\fC\-\-version\fR, \fB\fC\-v\fR
shows the version
.SH SEE ALSO
.PP
.BR nim (1),
Official documentation \[la]https://nim-lang.org/documentation.html\[ra]
-42
View File
@@ -1,42 +0,0 @@
.TH NIMSUGGEST 1 "SEPTEMBER 2017" Linux "User Manuals"
.SH NAME
.PP
nimsuggest \- tool to give every editor IDE like capabilities for Nim
.SH SYNOPSIS
.PP
\fB\fCnimsuggest\fR [\fIoptions\fP] \fIprojectfile.nim\fP
.SH OPTIONS
.PP
\fB\fC\-\-port\fR:\fIPORT\fP
port, by default 6000
.PP
\fB\fC\-\-address\fR:\fIHOST\fP
binds to that address, by default ""
.PP
\fB\fC\-\-stdin\fR
read commands from stdin and write results to stdout instead of using sockets
.PP
\fB\fC\-\-epc\fR
use emacs epc mode
.PP
\fB\fC\-\-debug\fR
enable debug output
.PP
\fB\fC\-\-log\fR
enable verbose logging to \fB\fCnimsuggest.log\fR file
.PP
\fB\fC\-\-v1\fR
use version 1 of the protocol; for backwards compatibility
.PP
\fB\fC\-\-refresh\fR
perform automatic refreshes to keep the analysis precise
.PP
\fB\fC\-\-maxresults\fR:\fIN\fP
limit the number of suggestions to N
.PP
\fB\fC\-\-tester\fR
implies \fB\fC\-\-stdin\fR and outputs a line \fB\fC\&'!EOF!'\fR for the tester
.SH SEE ALSO
.PP
.BR nim (1),
Official documentation \[la]https://nim-lang.org/docs/nimsuggest.html\[ra]
-1
View File
@@ -1 +0,0 @@
rpm.version(gh_tag("nim-lang/Nim"));
-5
View File
@@ -1,5 +0,0 @@
project pkg {
rpm {
spec = "nph.spec"
}
}
-31
View File
@@ -1,31 +0,0 @@
%define debug_package %nil
Name: nph
Version: 0.6.1
Release: 1%?dist
Summary: An opinionated code formatter for Nim
License: MIT
URL: https://github.com/arnetheduck/nph
Source0: %url/archive/refs/tags/v%version.tar.gz
SourceLicense: MIT
Packager: madonuko <mado@fyralabs.com>
BuildRequires: anda-srpm-macros
BuildRequires: nim
%description
nph is an opinionated source code formatter for the Nim language, aiming to take the drudgery of manual formatting out of your coding day.
%prep
%autosetup
%nim_prep -t:"%nim_tflags" -l:"%nim_lflags"
%build
nimble c -d:release -t:"%nim_tflags" -l:"%nim_lflags" src/nph
%install
install -Dpm755 src/nph %buildroot%_bindir/nph
%files
%_bindir/nph
%license copying.txt
%doc README.md
-1
View File
@@ -1 +0,0 @@
rpm.version(gh("arnetheduck/nph"));