Fix Nim v1.0.x compilation problems (#47)

* Fix #46.

* Bump version to 0.5.4.

* Disable Travis cache.

* Fix travis cache problems.
This commit is contained in:
Eugene Kabanov 2020-09-07 17:51:33 +03:00 committed by GitHub
parent 78b53fa70d
commit a065c17418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 113 additions and 39 deletions

View File

@ -1,20 +1,44 @@
sudo: false
language: c
os:
- linux
- osx
dist: xenial
cache:
ccache: true
directories:
- NimV1
jobs:
include:
- os: linux
arch: amd64
env:
- NPROC=2
- NIM_DIR=NimDev
- NIM_BRANCH=devel
dist: xenial
- os: linux
arch: amd64
env:
- NPROC=2
- NIM_DIR=NimV1
- NIM_BRANCH=v1.0.8
dist: xenial
- os: osx
env:
- NPROC=2
- NIM_DIR=NimDev
- NIM_BRANCH=devel
before_install:
- HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install ccache
- os: osx
env:
- NPROC=2
- NIM_DIR=NimV1
- NIM_BRANCH=v1.0.8
before_install:
- HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install ccache
before_script:
- git clone https://github.com/nim-lang/Nim.git
- cd Nim
- git clone --depth 1 https://github.com/nim-lang/csources
- cd csources && sh build.sh
- cd ..
- bin/nim c koch
- ./koch boot -d:release
- ./koch nimble
- export PATH=$(pwd)/bin:$PATH
- cd ..
- ./tests/bootstrap.sh
- export PATH="$(pwd)/$NIM_DIR/bin:$PATH"
script:
- echo $PATH
- nim --version
- nimble install -y --verbose
- nimble test

View File

@ -3,8 +3,8 @@ version: '{build}'
cache:
- x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z
- i686-8.1.0-release-win32-dwarf-rt_v6-rev0.7z
- sqlite-dll-win64-x64-3310100.zip
- sqlite-dll-win32-x86-3290000.zip
- NimV1x64
- NimV1x32
matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
@ -14,35 +14,39 @@ environment:
- MINGW_DIR: mingw64
MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/seh/x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z/download
MINGW_ARCHIVE: x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z
SQLITE_URL: https://www.sqlite.org/2020/sqlite-dll-win64-x64-3310100.zip
SQLITE_ARCHIVE: sqlite-dll-win64-x64-3310100.zip
SQLITE_NAME: sqlite3_64.dll
platform: x64
NIM_DIR: NimDev
NIM_BRANCH: devel
- MINGW_DIR: mingw64
MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/seh/x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z/download
MINGW_ARCHIVE: x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z
platform: x64
NIM_DIR: NimV1x64
NIM_BRANCH: v1.0.8
- MINGW_DIR: mingw32
MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-win32/dwarf/i686-8.1.0-release-win32-dwarf-rt_v6-rev0.7z/download
MINGW_ARCHIVE: i686-8.1.0-release-win32-dwarf-rt_v6-rev0.7z
SQLITE_URL: https://www.sqlite.org/2020/sqlite-dll-win32-x86-3310100.zip
SQLITE_ARCHIVE: sqlite-dll-win32-x86-3310100.zip
SQLITE_NAME: sqlite3_32.dll
platform: x86
NIM_DIR: NimDev
NIM_BRANCH: devel
- MINGW_DIR: mingw32
MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-win32/dwarf/i686-8.1.0-release-win32-dwarf-rt_v6-rev0.7z/download
MINGW_ARCHIVE: i686-8.1.0-release-win32-dwarf-rt_v6-rev0.7z
platform: x86
NIM_DIR: NimV1x32
NIM_BRANCH: v1.0.8
install:
- IF not exist "%MINGW_ARCHIVE%" appveyor DownloadFile "%MINGW_URL%" -FileName "%MINGW_ARCHIVE%"
- IF not exist "%SQLITE_ARCHIVE%" appveyor DownloadFile "%SQLITE_URL%" -FileName "%SQLITE_ARCHIVE%"
- 7z x -y "%MINGW_ARCHIVE%" > nul
- SET PATH=%CD%\%MINGW_DIR%\bin;%CD%\Nim\bin;%PATH%
- git clone https://github.com/nim-lang/Nim.git %CD%\Nim
- 7z x -y "%SQLITE_ARCHIVE%" -o"%CD%\Nim\bin" > nul
- RENAME "%CD%\Nim\bin\sqlite3.dll" "%SQLITE_NAME%"
- cd %CD%\Nim
- git clone --depth 1 https://github.com/nim-lang/csources
- cd csources
- IF "%PLATFORM%" == "x64" ( build64.bat ) else ( build.bat )
- cd ..
- bin\nim c koch
- koch boot -d:release
- koch nimble
- SET PATH=%CD%\%MINGW_DIR%\bin;%CD%\%NIM_DIR%\bin;%PATH%
- tests/bootstrap.bat
build_script:
- echo %PATH%
- nim --version
- cd C:\projects\nimcrypto
- nimble install -y --verbose
test_script:

View File

@ -1,6 +1,6 @@
# Package
version = "0.5.3"
version = "0.5.4"
author = "Eugene Kabanov"
description = "Nim cryptographic library"
license = "MIT"

View File

@ -188,7 +188,7 @@ func validateParam(N, r, p: int): bool =
maxIntd256 = maxInt div 256
let
badParam1 = uint64(r)*uint64(p) >= 1 shl 30
badParam1 = (uint64(r) * uint64(p)) >= uint64(1 shl 30)
badParam2 = r > maxIntd128 div p
badParam3 = r > maxIntd256
badParam4 = N > maxIntd128 div r

View File

@ -87,7 +87,7 @@ proc bytesToHex*(src: openarray[byte], dst: var openarray[char],
dst[k + 0] = hexDigit(x shr 4, lowercase)
inc(k)
return k
k
proc hexToBytes*(src: openarray[char], dst: var openarray[byte],
flags: set[HexFlags]): int =

25
tests/bootstrap.bat Normal file
View File

@ -0,0 +1,25 @@
@echo off
IF NOT EXIST "%CD%\%NIM_DIR%\bin\nim.exe" (
echo Building Nim [%NIM_BRANCH%] in %NIM_DIR%
git clone https://github.com/nim-lang/Nim.git "%CD%\%NIM_DIR%"
cd "%CD%\%NIM_DIR%"
IF NOT "%NIM_BRANCH%" == "devel" (
git checkout "tags/%NIM_BRANCH%" -b "%NIM_BRANCH%"
) ELSE (
git checkout devel
)
git clone --depth 1 https://github.com/nim-lang/csources
cd csources
IF "%PLATFORM%" == "x64" ( build64.bat ) else ( build.bat )
cd ..
bin\nim c -d:release koch
koch boot -d:release
koch nimble
cd ..
) ELSE (
cd "%CD%\%NIM_DIR%"
set GITBRANCH=
for /f %%I in ('git.exe rev-parse --abbrev-ref HEAD 2^> NUL') do set GITBRANCH=%%I
echo Using Nim [%GITBRANCH%] in %NIM_DIR%
cd ..
)

21
tests/bootstrap.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
if [ ! -e "$NIM_DIR/bin/nim" ]; then
echo "Building Nim [$NIM_BRANCH] in $NIM_DIR"
git clone https://github.com/nim-lang/Nim.git "$NIM_DIR"
cd "$NIM_DIR"
if [ "$NIM_BRANCH" = "devel" ]; then
git checkout devel
else
git checkout "tags/$NIM_BRANCH" -b "$NIM_BRANCH"
fi
git clone --depth 1 https://github.com/nim-lang/csources
cd csources && sh build.sh
cd ..
bin/nim c -d:release koch
./koch boot -d:release
./koch nimble -d:release
cd ..
else
GITBRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "Using Nim [$GITBRANCH] in $NIM_DIR"
fi