Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Exclude bpm archives
|
||||||
|
*.bpm
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Github repository
|
||||||
|
REPO="nim-lang/Nim"
|
||||||
|
|
||||||
|
# Get tag name using Github Rest API
|
||||||
|
TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/tags | jq -r '.[0].name')
|
||||||
|
|
||||||
|
# Trim 'v' character in TAG_NAME variable
|
||||||
|
VERSION=$(echo "$TAG_NAME" | tr -d 'v')
|
||||||
|
|
||||||
|
echo "$VERSION"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
name: nim
|
||||||
|
description: Statically typed compiled systems programming language
|
||||||
|
version: 2.2.4
|
||||||
|
url: https://nim-lang.org/
|
||||||
|
license: MIT
|
||||||
|
architecture: any
|
||||||
|
depends: ["bash","gcc","gcc-libs","glibc"]
|
||||||
|
type: source
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||||
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||||
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||||
|
|
||||||
|
DOWNLOAD="https://nim-lang.org/download/nim-${BPM_PKG_VERSION}.tar.xz"
|
||||||
|
FILENAME="${DOWNLOAD##*/}"
|
||||||
|
|
||||||
|
# The prepare function is executed in the root of the temp directory
|
||||||
|
# This function is used for downloading files and putting them into the correct location
|
||||||
|
prepare() {
|
||||||
|
wget "$DOWNLOAD"
|
||||||
|
tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE"
|
||||||
|
|
||||||
|
cd "$BPM_SOURCE"
|
||||||
|
for nimcfg in {compiler,config}/nim.cfg; do
|
||||||
|
echo "gcc.options.always %= \"\${gcc.options.always} ${CFLAGS:-} ${CPPFLAGS}\"" >> "$nimcfg"
|
||||||
|
echo "gcc.options.linker %= \"\${gcc.options.linker} ${LDFLAGS:-}\"" >> "$nimcfg"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# The build function is executed in the source directory
|
||||||
|
# This function is used to compile the source code
|
||||||
|
build() {
|
||||||
|
# Compile nim
|
||||||
|
sh build.sh
|
||||||
|
|
||||||
|
# Compile koch
|
||||||
|
./bin/nim c -d:release koch
|
||||||
|
./koch boot -d:release -d:nativeStacktrace -d:useGnuReadline
|
||||||
|
|
||||||
|
# Compile libraries
|
||||||
|
( cd lib; ../bin/nim c --app:lib -d:createNimRtl -d:release nimrtl.nim )
|
||||||
|
|
||||||
|
# Compile tools
|
||||||
|
./koch tools
|
||||||
|
( cd tools; ../bin/nim c -d:release nimgrep.nim )
|
||||||
|
|
||||||
|
# Compile nimsuggest
|
||||||
|
./bin/nim c -d:release nimsuggest/nimsuggest.nim
|
||||||
|
}
|
||||||
|
|
||||||
|
# The package function is executed in the source directory
|
||||||
|
# This function is used to move the compiled files into the output directory
|
||||||
|
package() {
|
||||||
|
./koch install "$BPM_OUTPUT"
|
||||||
|
|
||||||
|
# Install libraries and compiler
|
||||||
|
install -d "$BPM_OUTPUT"/usr/lib
|
||||||
|
cp -a lib "$BPM_OUTPUT"/usr/lib/nim
|
||||||
|
cp -a compiler "$BPM_OUTPUT"/usr/lib/nim
|
||||||
|
install -Dm644 nim.nimble "$BPM_OUTPUT"/usr/lib/nim/compiler
|
||||||
|
install -m755 lib/libnimrtl.so "$BPM_OUTPUT"/usr/lib/libnimrtl.so
|
||||||
|
|
||||||
|
# Install binaries
|
||||||
|
install -Dm755 bin/* -t "$BPM_OUTPUT"/usr/bin
|
||||||
|
|
||||||
|
# Install configuration
|
||||||
|
install -Dm644 config/* -t "$BPM_OUTPUT"/etc/nim
|
||||||
|
|
||||||
|
# Move header files
|
||||||
|
install -d "$BPM_OUTPUT"/usr/include
|
||||||
|
cp -a "$BPM_OUTPUT"/usr/lib/nim/*.h -t "$BPM_OUTPUT"/usr/include
|
||||||
|
|
||||||
|
# Fix wrong path for system.nim
|
||||||
|
ln -s /usr/lib/nim "$BPM_OUTPUT"/usr/lib/nim/lib
|
||||||
|
|
||||||
|
# Install shell completion
|
||||||
|
install -Dm644 tools/nim.bash-completion "$BPM_OUTPUT"/usr/share/bash-completion/completions/nim
|
||||||
|
install -Dm644 tools/nim.zsh-completion "$BPM_OUTPUT"/usr/share/zsh/site-functions/_nim
|
||||||
|
|
||||||
|
# Remove unwanted files
|
||||||
|
rm -r "$BPM_OUTPUT"/nim
|
||||||
|
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/copying.txt "$BPM_OUTPUT"/usr/share/licenses/nim/copying.txt
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user