summaryrefslogtreecommitdiffstats
path: root/development/nim
diff options
context:
space:
mode:
Diffstat (limited to 'development/nim')
-rw-r--r--development/nim/README5
-rw-r--r--development/nim/doinst.sh29
-rw-r--r--development/nim/fix-lib-path.patch12
-rw-r--r--development/nim/fix-nim-gdb-path.patch12
-rw-r--r--development/nim/nim.SlackBuild152
-rw-r--r--development/nim/nim.info10
-rw-r--r--development/nim/remove-missing-documentation.patch108
-rw-r--r--development/nim/slack-desc19
8 files changed, 347 insertions, 0 deletions
diff --git a/development/nim/README b/development/nim/README
new file mode 100644
index 0000000000..c7d503b4a1
--- /dev/null
+++ b/development/nim/README
@@ -0,0 +1,5 @@
+Nim is a statically typed compiled systems programming language. It
+combines successful concepts from mature languages like Python, Ada
+and Modula.
+
+This package also includes the Nimble package manager.
diff --git a/development/nim/doinst.sh b/development/nim/doinst.sh
new file mode 100644
index 0000000000..6529a640ac
--- /dev/null
+++ b/development/nim/doinst.sh
@@ -0,0 +1,29 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/nim/nim.cfg.new
+preserve_perms etc/nim/nimdoc.cfg.new
+preserve_perms etc/nim/nimdoc.tex.cfg.new
+preserve_perms etc/nim/config.nims.new
+preserve_perms etc/nim/rename.rules.cfg.new
diff --git a/development/nim/fix-lib-path.patch b/development/nim/fix-lib-path.patch
new file mode 100644
index 0000000000..50aea5da39
--- /dev/null
+++ b/development/nim/fix-lib-path.patch
@@ -0,0 +1,12 @@
+diff -ur nim-2.2.0-orig/install.sh nim-2.2.0/install.sh
+--- nim-2.2.0-orig/install.sh 2024-10-04 13:48:24.730391583 +0200
++++ nim-2.2.0/install.sh 2024-10-06 15:57:45.877571032 +0200
+@@ -27,7 +27,7 @@
+ "/usr/bin")
+ bindir=$1
+ configdir="/etc/nim"
+- libdir="/usr/lib/nim"
++ libdir="/usr/lib/nim/lib"
+ docdir="/usr/share/nim/doc"
+ datadir="/usr/share/nim/data"
+ nimbleDir="/opt/nimble/pkgs/nim-2.2.0"
diff --git a/development/nim/fix-nim-gdb-path.patch b/development/nim/fix-nim-gdb-path.patch
new file mode 100644
index 0000000000..a0992d438d
--- /dev/null
+++ b/development/nim/fix-nim-gdb-path.patch
@@ -0,0 +1,12 @@
+diff -ur nim-2.2.0-orig/bin/nim-gdb nim-2.2.0/bin/nim-gdb
+--- nim-2.2.0-orig/bin/nim-gdb 2024-10-04 13:48:24.730391583 +0200
++++ nim-2.2.0/bin/nim-gdb 2024-10-06 15:02:47.005375794 +0200
+@@ -14,7 +14,7 @@
+ fi
+
+ # Find out where the pretty printer Python module is
+-GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/debug/nim-gdb.py"
++GDB_PYTHON_MODULE_PATH="/usr/lib/nim/tools/nim-gdb.py"
+
+ # Run GDB with the additional arguments that load the pretty printers
+ # Set the environment variable `NIM_GDB` to overwrite the call to a
diff --git a/development/nim/nim.SlackBuild b/development/nim/nim.SlackBuild
new file mode 100644
index 0000000000..3440dfbf32
--- /dev/null
+++ b/development/nim/nim.SlackBuild
@@ -0,0 +1,152 @@
+#!/bin/bash
+
+# Slackware build script for nim
+
+# Copyright 2024 by Nick Smallbone <nick@smallbone.se>
+# Copyright 2022 by Ruben Schuller <sb@rbn.im>
+# Maintained 2020-2021 by Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=nim
+VERSION=${VERSION:-2.2.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+patch -p1 < $CWD/remove-missing-documentation.patch
+patch -p1 < $CWD/fix-lib-path.patch
+patch -p1 < $CWD/fix-nim-gdb-path.patch
+./build.sh --extraBuildArgs "$SLKCFLAGS"
+bin/nim c -d:release koch
+./koch boot -d:release
+
+# Build extra tools, and documentation
+./koch toolsNoExternal -d:release
+./koch nimble -d:release
+bin/nim c -d:release tools/niminst/niminst
+# use --docCmd:skip to skip runnable examples because some require network access
+./koch --localdocs doc -d:release --docCmd:skip
+
+DESTDIR=$PKG ./install.sh /usr/bin
+
+# Install extra binaries
+for fn in nim-gdb nimble nimgrep nimpretty nimsuggest testament; do cp bin/$fn $PKG/usr/bin/; done
+cp tools/niminst/niminst $PKG/usr/bin/
+
+# Install miscellaneous stuff according to doc/packaging.md
+mkdir -p $PKG/usr/lib/nim/tools/dochack $PKG/usr/lib/nim/doc
+cp doc/nimdoc.css doc/nimdoc.cls $PKG/usr/lib/nim/doc/
+cp tools/dochack/dochack.js $PKG/usr/lib/nim/tools/dochack/
+cp tools/debug/nim-gdb.py $PKG/usr/lib/nim/tools/
+
+# Install the compiler and dependencies
+cp -r compiler $PKG/usr/lib/nim/lib
+cp nim.nimble $PKG/usr/lib/nim/lib/compiler
+mkdir -p $PKG/usr/lib/nim/lib/dist
+cp -r dist/checksums $PKG/usr/lib/nim/lib/dist
+
+# Install completions
+mkdir -p $PKG/usr/share/bash-completion/completions \
+ $PKG/usr/share/zsh/site-functions
+for i in tools/nim dist/nimble/nimble; do
+ cp $i.bash-completion $PKG/usr/share/bash-completion/completions/$(basename $i)
+ cp $i.zsh-completion $PKG/usr/share/zsh/site-functions/_$(basename $i)
+done
+
+# Use .new for configuration files
+for i in config.nims nim.cfg nimdoc.cfg nimdoc.tex.cfg rename.rules.cfg; do
+ mv $PKG/etc/nim/$i $PKG/etc/nim/$i.new
+done
+find $PKG -depth -type d -empty -delete # remove needless empty dirs
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \
+ grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ copying.txt doc/html changelogs \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ dist/nimble/nimble-guide/docs \
+ $PKG/usr/doc/$PRGNAM-$VERSION/nimble
+rm $PKG/usr/doc/$PRGNAM-$VERSION/changelogs/readme.md
+rm $PKG/usr/doc/$PRGNAM-$VERSION/changelogs/changelog_X_XX_X.md
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/development/nim/nim.info b/development/nim/nim.info
new file mode 100644
index 0000000000..6fafc57a42
--- /dev/null
+++ b/development/nim/nim.info
@@ -0,0 +1,10 @@
+PRGNAM="nim"
+VERSION="2.2.0"
+HOMEPAGE="https://nim-lang.org"
+DOWNLOAD="https://nim-lang.org/download/nim-2.2.0.tar.xz"
+MD5SUM="e2b4b57e1bc2e1e6b0d9766d17c46fb9"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Nick Smallbone"
+EMAIL="nick@smallbone.se"
diff --git a/development/nim/remove-missing-documentation.patch b/development/nim/remove-missing-documentation.patch
new file mode 100644
index 0000000000..0c88be760c
--- /dev/null
+++ b/development/nim/remove-missing-documentation.patch
@@ -0,0 +1,108 @@
+diff -ur nim-2.2.0-orig/doc/lib.md nim-2.2.0/doc/lib.md
+--- nim-2.2.0-orig/doc/lib.md 2024-10-04 13:48:24.723391623 +0200
++++ nim-2.2.0/doc/lib.md 2024-10-06 14:28:26.817978213 +0200
+@@ -163,9 +163,6 @@
+ * [objectdollar](objectdollar.html)
+ A generic `$` operator to convert objects to strings.
+
+-* [punycode](punycode.html)
+- Implements a representation of Unicode with the limited ASCII character subset.
+-
+ * [strbasics](strbasics.html)
+ Some high performance string operations.
+
+@@ -326,9 +323,6 @@
+ * [asyncfile](asyncfile.html)
+ An asynchronous file reading and writing using `asyncdispatch`.
+
+-* [asyncftpclient](asyncftpclient.html)
+- An asynchronous FTP client using the `asyncnet` module.
+-
+ * [asynchttpserver](asynchttpserver.html)
+ An asynchronous HTTP server using the `asyncnet` module.
+
+@@ -364,9 +358,6 @@
+ A selector API with backends specific to each OS.
+ Supported OS primitives: `epoll`, `kqueue`, `poll`, and `select` on Windows.
+
+-* [smtp](smtp.html)
+- A simple SMTP client with support for both synchronous and asynchronous operation.
+-
+ * [socketstreams](socketstreams.html)
+ An implementation of the streams interface for sockets.
+
+@@ -603,26 +594,6 @@
+ Many help functions for handling regular expressions.
+ The current implementation uses PCRE.
+
+-Database support
+-----------------
+-
+-* [db_mysql](db_mysql.html)
+- A higher level MySQL database wrapper. The same interface is implemented
+- for other databases too.
+-
+-* [db_odbc](db_odbc.html)
+- A higher level ODBC database wrapper. The same interface is implemented
+- for other databases too.
+-
+-* [db_postgres](db_postgres.html)
+- A higher level PostgreSQL database wrapper. The same interface is implemented
+- for other databases too.
+-
+-* [db_sqlite](db_sqlite.html)
+- A higher level SQLite database wrapper. The same interface is implemented
+- for other databases too.
+-
+-
+ Generic Operating System Services
+ ---------------------------------
+
+diff -ur nim-2.2.0-orig/tools/kochdocs.nim nim-2.2.0/tools/kochdocs.nim
+--- nim-2.2.0-orig/tools/kochdocs.nim 2024-10-04 13:48:24.101395116 +0200
++++ nim-2.2.0/tools/kochdocs.nim 2024-10-06 14:36:17.704553470 +0200
+@@ -94,7 +94,6 @@
+ execFold(desc, cmd)
+
+ const officialPackagesMarkdown = """
+-pkgs/atlas/doc/atlas.md
+ """.splitWhitespace()
+
+ proc getMd2html(): seq[string] =
+@@ -158,28 +157,9 @@
+ """.splitWhitespace()
+
+ officialPackagesList = """
+-pkgs/asyncftpclient/src/asyncftpclient.nim
+-pkgs/smtp/src/smtp.nim
+-pkgs/punycode/src/punycode.nim
+-pkgs/db_connector/src/db_connector/db_common.nim
+-pkgs/db_connector/src/db_connector/db_mysql.nim
+-pkgs/db_connector/src/db_connector/db_odbc.nim
+-pkgs/db_connector/src/db_connector/db_postgres.nim
+-pkgs/db_connector/src/db_connector/db_sqlite.nim
+-pkgs/checksums/src/checksums/md5.nim
+-pkgs/checksums/src/checksums/sha1.nim
+-pkgs/checksums/src/checksums/sha2.nim
+-pkgs/checksums/src/checksums/sha3.nim
+-pkgs/checksums/src/checksums/bcrypt.nim
+-pkgs/htmlparser/src/htmlparser.nim
+ """.splitWhitespace()
+
+ officialPackagesListWithoutIndex = """
+-pkgs/db_connector/src/db_connector/mysql.nim
+-pkgs/db_connector/src/db_connector/sqlite3.nim
+-pkgs/db_connector/src/db_connector/postgres.nim
+-pkgs/db_connector/src/db_connector/odbcsql.nim
+-pkgs/db_connector/src/db_connector/private/dbutils.nim
+ """.splitWhitespace()
+
+ when (NimMajor, NimMinor) < (1, 1) or not declared(isRelativeTo):
+@@ -348,7 +328,6 @@
+ proc buildDocsDir*(args: string, dir: string) =
+ let args = nimArgs & " " & args
+ let docHackJsSource = buildJS()
+- gitClonePackages(@["asyncftpclient", "punycode", "smtp", "db_connector", "checksums", "atlas", "htmlparser"])
+ createDir(dir)
+ buildDocSamples(args, dir)
+
diff --git a/development/nim/slack-desc b/development/nim/slack-desc
new file mode 100644
index 0000000000..894667ace4
--- /dev/null
+++ b/development/nim/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+nim: nim (programming language)
+nim:
+nim: Nim is a statically typed compiled systems programming language. It
+nim: combines successful concepts from mature languages like Python, Ada
+nim: and Modula.
+nim:
+nim: This package also includes the Nimble package manager.
+nim:
+nim:
+nim:
+nim: