Don't require getopt to be installed by brew on macOS for Nix users
Other changes: * Add/Update copyright banners * Add post-review comment for https://github.com/status-im/nimbus-eth2/pull/5719
This commit is contained in:
parent
b98f46c04d
commit
05fb7ffff0
|
@ -1964,6 +1964,14 @@ proc p2pProtocolBackendImpl*(p: P2PProtocol): Backend =
|
||||||
codecNameLit))
|
codecNameLit))
|
||||||
|
|
||||||
result.implementProtocolInit = proc (p: P2PProtocol): NimNode =
|
result.implementProtocolInit = proc (p: P2PProtocol): NimNode =
|
||||||
|
# TODO
|
||||||
|
# This current approach is not building on good foundations.
|
||||||
|
# Incrementing a global variable at compile-time fundamentally at odds with
|
||||||
|
# incremental compilation (because a recompile that doesn't revisit the whole
|
||||||
|
# program will mess up the counting and create duplicate indices).
|
||||||
|
# A better approach would build upon the `macrocache` module from the standard
|
||||||
|
# library, which is compatible with incremental compilation:
|
||||||
|
# https://nim-lang.org/docs/macrocache.html
|
||||||
var id {.global.}: int
|
var id {.global.}: int
|
||||||
let tmp = id
|
let tmp = id
|
||||||
id += 1
|
id += 1
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
# beacon_chain
|
||||||
|
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
{ pkgs ? import <nixpkgs> {}}:
|
{ pkgs ? import <nixpkgs> {}}:
|
||||||
let
|
let
|
||||||
mkdocs-packages = ps: with ps; [
|
mkdocs-packages = ps: with ps; [
|
||||||
|
@ -16,6 +23,7 @@ mkShell {
|
||||||
git
|
git
|
||||||
git-lfs
|
git-lfs
|
||||||
gnumake
|
gnumake
|
||||||
|
getopt
|
||||||
|
|
||||||
# For the local simulation
|
# For the local simulation
|
||||||
openssl # for generating the JWT file
|
openssl # for generating the JWT file
|
||||||
|
@ -34,6 +42,7 @@ mkShell {
|
||||||
# will erase `-march=native` because this introduces impurity in the build.
|
# will erase `-march=native` because this introduces impurity in the build.
|
||||||
# For the purposes of compiling Nimbus, this behavior is not desired:
|
# For the purposes of compiling Nimbus, this behavior is not desired:
|
||||||
export NIX_ENFORCE_NO_NATIVE=0
|
export NIX_ENFORCE_NO_NATIVE=0
|
||||||
|
export USE_SYSTEM_GETOPT=1
|
||||||
|
|
||||||
figlet "Welcome to Nimbus-eth2"
|
figlet "Welcome to Nimbus-eth2"
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2020-2023 Status Research & Development GmbH. Licensed under
|
# Copyright (c) 2020-2024 Status Research & Development GmbH. Licensed under
|
||||||
# either of:
|
# either of:
|
||||||
# - Apache License, version 2.0
|
# - Apache License, version 2.0
|
||||||
# - MIT license
|
# - MIT license
|
||||||
|
@ -34,7 +34,7 @@ PIDS_TO_WAIT=""
|
||||||
####################
|
####################
|
||||||
|
|
||||||
GETOPT_BINARY="getopt"
|
GETOPT_BINARY="getopt"
|
||||||
if [[ "${OS}" == "macos" ]]; then
|
if [[ "${OS}" == "macos" && "$USE_SYSTEM_GETOPT" != "1" ]]; then
|
||||||
# Without the head -n1 constraint, it gets confused by multiple matches
|
# Without the head -n1 constraint, it gets confused by multiple matches
|
||||||
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null | head -n1 || true)
|
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null | head -n1 || true)
|
||||||
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
|
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
|
||||||
|
|
Loading…
Reference in New Issue