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 \
automake \
@ -13,7 +13,7 @@ RUN apk update && apk add autoconf \
sqlite-dev \
sqlite-static
ENV NIM_VERSION v1.6.12
ENV LIBRESSL_VERSION v3.8.0
# 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" .. && \
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
WORKDIR /app
# Build with necessary params to enable statically linking openssl, glibc and sqlite3
RUN /root/.nimble/bin/nimble build --passL:-L/usr/lib \
-d:ssl \
-d:libressl \
-p:. \
--dynlibOverride:ssl \
--dynlibOverride:crypto \
--dynlibOverride:sqlite3 \
--dynlibOverride:tls \
--passl:-lssl \
--passl:-lsqlite3 \
--passl:-lcrypto \
--passl:-ltls \
--passL:-L/libressl/build-ninja/ssl \
--passL:-L/libressl/build-ninja/crypto \
--passL:-L/libressl/build-ninja/tls \
--passL:-static \
--passL:"-flto" \
-d:release \
--opt:speed \
--mm:orc \
--deepcopy=on \
--accept
RUN nimble build --passL:-L/usr/lib \
-d:ssl \
-d:libressl \
-p:. \
--dynlibOverride:ssl \
--dynlibOverride:crypto \
--dynlibOverride:sqlite3 \
--dynlibOverride:tls \
--passl:-lssl \
--passl:-lsqlite3 \
--passl:-lcrypto \
--passl:-ltls \
--passL:-L/libressl/build-ninja/ssl \
--passL:-L/libressl/build-ninja/crypto \
--passL:-L/libressl/build-ninja/tls \
--passL:-static \
--passL:"-flto" \
-d:release \
--opt:speed \
--mm:orc \
--threadAnalysis:off \
--deepcopy=on \
--accept
RUN strip -s /app/nim_censor_bot && \
strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot

View file

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