fix compilation on Debian 7 (no git -C) (#18427)

* fix compilation on Debian 7 (no git -C)

* address review

* allow specify branch for testing unmerged csources

* temporarily change csources checkout parameters for testing

* Update tools/deps.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* fix failure

* Update config/build_config.txt

* set proper git branch/hash

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Andrey Makarov 2021-07-06 21:09:56 +03:00 • committed by GitHub
commit b88496ac67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 9 deletions

View file

@ -10,7 +10,7 @@ SET nim_csources=bin\nim_csources_%nim_csourcesHash%.exe
echo "building from csources: %nim_csources%" echo "building from csources: %nim_csources%"
if not exist %nim_csourcesDir% ( if not exist %nim_csourcesDir% (
git clone -q --depth 1 %nim_csourcesUrl% %nim_csourcesDir% git clone -q --depth 1 -b %nim_csourcesBranch% %nim_csourcesUrl% %nim_csourcesDir%
) )
if not exist %nim_csources% ( if not exist %nim_csources% (

View file

@ -10,7 +10,7 @@ SET nim_csources=bin\nim_csources_%nim_csourcesHash%.exe
echo "building from csources: %nim_csources%" echo "building from csources: %nim_csources%"
if not exist %nim_csourcesDir% ( if not exist %nim_csourcesDir% (
git clone -q --depth 1 %nim_csourcesUrl% %nim_csourcesDir% git clone -q --depth 1 -b %nim_csourcesBranch% %nim_csourcesUrl% %nim_csourcesDir%
) )
if not exist %nim_csources% ( if not exist %nim_csources% (

View file

@ -120,8 +120,12 @@ nimBuildCsourcesIfNeeded(){
else else
# Note: using git tags would allow fetching just what's needed, unlike git hashes, e.g. # Note: using git tags would allow fetching just what's needed, unlike git hashes, e.g.
# via `git clone -q --depth 1 --branch $tag $nim_csourcesUrl`. # via `git clone -q --depth 1 --branch $tag $nim_csourcesUrl`.
echo_run git clone -q --depth 1 $nim_csourcesUrl "$nim_csourcesDir" echo_run git clone -q --depth 1 -b $nim_csourcesBranch \
echo_run git -C "$nim_csourcesDir" checkout $nim_csourcesHash $nim_csourcesUrl "$nim_csourcesDir"
# old `git` versions don't support -C option, using `cd` explicitly:
echo_run cd "$nim_csourcesDir"
echo_run git checkout $nim_csourcesHash
echo_run cd "$OLDPWD"
# if needed we could also add: `git reset --hard $nim_csourcesHash` # if needed we could also add: `git reset --hard $nim_csourcesHash`
fi fi
_nimBuildCsourcesIfNeeded "$@" _nimBuildCsourcesIfNeeded "$@"

View file

@ -1,4 +1,5 @@
nim_comment="key-value pairs for windows/posix bootstrapping build scripts" nim_comment="key-value pairs for windows/posix bootstrapping build scripts"
nim_csourcesDir=csources_v1 nim_csourcesDir=csources_v1
nim_csourcesUrl=https://github.com/nim-lang/csources_v1.git nim_csourcesUrl=https://github.com/nim-lang/csources_v1.git
nim_csourcesHash=a8a5241f9475099c823cfe1a5e0ca4022ac201ff nim_csourcesBranch=master
nim_csourcesHash=9a7f751d23c49c75a0b6f63a234c575dc0df7231

View file

@ -61,7 +61,7 @@ SET nim_csources=bin\nim_csources_%nim_csourcesHash%.exe
echo "building from csources: %nim_csources%" echo "building from csources: %nim_csources%"
if not exist %nim_csourcesDir% ( if not exist %nim_csourcesDir% (
git clone -q --depth 1 %nim_csourcesUrl% %nim_csourcesDir% git clone -q --depth 1 -b %nim_csourcesBranch% %nim_csourcesUrl% %nim_csourcesDir%
) )
if not exist %nim_csources% ( if not exist %nim_csources% (

View file

@ -28,8 +28,13 @@ proc cloneDependency*(destDirBase: string, url: string, commit = commitHead,
# from failing # from failing
execRetry fmt"git clone -q {url} {destDir2}" execRetry fmt"git clone -q {url} {destDir2}"
if isGitRepo(destDir): if isGitRepo(destDir):
execRetry fmt"git -C {destDir2} fetch -q" let oldDir = getCurrentDir()
exec fmt"git -C {destDir2} checkout -q {commit}" setCurrentDir(destDir2)
try:
execRetry "git fetch -q"
exec fmt"git checkout -q {commit}"
finally:
setCurrentDir(oldDir)
elif allowBundled: elif allowBundled:
discard "this dependency was bundled with Nim, don't do anything" discard "this dependency was bundled with Nim, don't do anything"
else: else:

View file

@ -25,7 +25,8 @@ endif
ifeq ($(uos),linux) ifeq ($(uos),linux)
myos = linux myos = linux
LDFLAGS += -ldl -lm # add -lrt to avoid "undefined reference to `clock_gettime'" with glibc<2.17
LDFLAGS += -ldl -lm -lrt
endif endif
ifeq ($(uos),dragonfly) ifeq ($(uos),dragonfly)
myos = freebsd myos = freebsd