Upgrade to Nim 2.0

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2023-08-21 15:05:53 +05:30
parent 11742447a4
commit 55849a5847
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
2 changed files with 29 additions and 42 deletions

View file

@ -1,4 +1,4 @@
FROM alpine:edge as builder FROM nimlang/nim:2.0.0-alpine as builder
RUN apk update && apk add autoconf \ RUN apk update && apk add autoconf \
automake \ automake \
@ -13,7 +13,7 @@ RUN apk update && apk add autoconf \
sqlite-dev \ sqlite-dev \
sqlite-static sqlite-static
ENV NIM_VERSION v1.6.12
ENV LIBRESSL_VERSION v3.8.0 ENV LIBRESSL_VERSION v3.8.0
# Compile LibreSSL Portable from source # Compile LibreSSL Portable from source
@ -25,46 +25,33 @@ RUN git clone https://github.com/libressl/portable --depth=1 -b ${LIBRESSL_VERSI
cmake -G"Ninja" .. && \ cmake -G"Ninja" .. && \
ninja ninja
# Compile Nim from source including upstream patch
RUN git clone https://github.com/nim-lang/Nim.git --depth=1 -b ${NIM_VERSION} && \
cd Nim && \
git config user.name gitlab && \
git config user.email gitlab-ci@git.baalajimaestro.me && \
curl https://github.com/nim-lang/Nim/commit/7c96eb45482dae4a78cf05d7fa85ae5018e2fe5f.patch | git am && \
bash build_all.sh
# Add built nim to path
ENV PATH=/Nim/bin:$PATH
# Update nimble
RUN nimble install nimble --accept
COPY . /app COPY . /app
WORKDIR /app WORKDIR /app
# Build with necessary params to enable statically linking openssl, glibc and sqlite3 # Build with necessary params to enable statically linking openssl, glibc and sqlite3
RUN /root/.nimble/bin/nimble build --passL:-L/usr/lib \ RUN nimble build --passL:-L/usr/lib \
-d:ssl \ -d:ssl \
-d:libressl \ -d:libressl \
-p:. \ -p:. \
--dynlibOverride:ssl \ --dynlibOverride:ssl \
--dynlibOverride:crypto \ --dynlibOverride:crypto \
--dynlibOverride:sqlite3 \ --dynlibOverride:sqlite3 \
--dynlibOverride:tls \ --dynlibOverride:tls \
--passl:-lssl \ --passl:-lssl \
--passl:-lsqlite3 \ --passl:-lsqlite3 \
--passl:-lcrypto \ --passl:-lcrypto \
--passl:-ltls \ --passl:-ltls \
--passL:-L/libressl/build-ninja/ssl \ --passL:-L/libressl/build-ninja/ssl \
--passL:-L/libressl/build-ninja/crypto \ --passL:-L/libressl/build-ninja/crypto \
--passL:-L/libressl/build-ninja/tls \ --passL:-L/libressl/build-ninja/tls \
--passL:-static \ --passL:-static \
--passL:"-flto" \ --passL:"-flto" \
-d:release \ -d:release \
--opt:speed \ --opt:speed \
--mm:orc \ --mm:orc \
--deepcopy=on \ --threadAnalysis:off \
--accept --deepcopy=on \
--accept
RUN strip -s /app/nim_censor_bot && \ RUN strip -s /app/nim_censor_bot && \
strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot

View file

@ -1,6 +1,6 @@
# Package # Package
version = "0.2.0" version = "0.3.0"
author = "baalajimaestro" author = "baalajimaestro"
description = "Censor Bot for Telegram written in Nim" description = "Censor Bot for Telegram written in Nim"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
@ -10,6 +10,6 @@ bin = @["nim_censor_bot"]
# Dependencies # Dependencies
requires "nim >= 1.6.0" requires "nim >= 2.0.0"
requires "telebot >= 2023.05.31" requires "telebot >= 2023.08.20"
requires "norm >= 2.8.0" requires "norm >= 2.8.1"