fix(status-go)_: add missing status-go dependencies (#16470)
Requires things like: go-bindata mockgen protobuf Fixes: https://github.com/status-im/status-desktop/issues/16477 For more details see: https://github.com/status-im/status-go/pull/5878 Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
717a792e8c
commit
a4646cd71c
8
Makefile
8
Makefile
|
@ -149,7 +149,7 @@ $(BOTTLES_DIR):
|
|||
bottles: $(BOTTLES)
|
||||
endif
|
||||
|
||||
deps: | check-qt-dir deps-common bottles
|
||||
deps: | check-qt-dir deps-common status-go-deps bottles
|
||||
|
||||
update: | check-qt-dir update-common
|
||||
ifeq ($(detected_OS),Darwin)
|
||||
|
@ -434,7 +434,7 @@ STATUSGO := vendor/status-go/build/bin/libstatus.$(LIBSTATUS_EXT)
|
|||
STATUSGO_LIBDIR := $(shell pwd)/$(shell dirname "$(STATUSGO)")
|
||||
export STATUSGO_LIBDIR
|
||||
|
||||
$(STATUSGO): | deps
|
||||
$(STATUSGO): | deps status-go-deps
|
||||
echo -e $(BUILD_MSG) "status-go"
|
||||
# FIXME: Nix shell usage breaks builds due to Glibc mismatch.
|
||||
$(MAKE) -C vendor/status-go statusgo-shared-library SHELL=/bin/sh \
|
||||
|
@ -442,6 +442,10 @@ $(STATUSGO): | deps
|
|||
|
||||
status-go: $(STATUSGO)
|
||||
|
||||
status-go-deps:
|
||||
go install go.uber.org/mock/mockgen@v0.4.0
|
||||
go install github.com/kevinburke/go-bindata/v4/...@v4.0.2
|
||||
|
||||
status-go-clean:
|
||||
echo -e "\033[92mCleaning:\033[39m status-go"
|
||||
rm -f $(STATUSGO)
|
||||
|
|
|
@ -40,7 +40,7 @@ RUN apt update -yq && apt install -yq software-properties-common \
|
|||
&& add-apt-repository -y ppa:git-core/ppa \
|
||||
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
|
||||
&& apt update -yq && apt full-upgrade -yq && apt install -yq --no-install-recommends --fix-missing \
|
||||
gnupg2 openssh-client ca-certificates locales sudo jq curl wget fuse s3cmd file llvm tk-dev xz-utils \
|
||||
gnupg2 openssh-client ca-certificates locales sudo jq curl wget fuse s3cmd file unzip llvm tk-dev xz-utils \
|
||||
git make build-essential pkg-config extra-cmake-modules gcc-9 g++-9 \
|
||||
libgl1-mesa-dev libsm6 libice6 libfontconfig1 libdbus-1-3 libssl-dev libz-dev \
|
||||
zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev unixodbc-dev libpq-dev \
|
||||
|
@ -89,6 +89,22 @@ RUN GOLANG_SHA256="e330e5d977bf4f3bdc157bc46cf41afa5b13d66c914e12fd6b694ccda65fc
|
|||
&& rm "${GOLANG_TARBALL}" \
|
||||
&& sudo ln -s /usr/local/go/bin/go /usr/local/bin
|
||||
|
||||
# Install Protoc
|
||||
RUN PROTOC_SHA256="75d8a9d7a2c42566e46411750d589c51276242d8b6247a5724bac0f9283e05a8" \
|
||||
&& PROTOC_TARBALL="protoc-3.20.0-linux-x86_64.zip" \
|
||||
&& wget -q "https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/${PROTOC_TARBALL}" \
|
||||
&& echo "${PROTOC_SHA256} ${PROTOC_TARBALL}" | sha256sum -c \
|
||||
&& sudo unzip -d /usr/local "${PROTOC_TARBALL}" \
|
||||
&& rm "${PROTOC_TARBALL}"
|
||||
|
||||
# Install Protoc-deg-go
|
||||
RUN PROTOC_GEN_SHA256="0b2c257938a8cd9ba3506bbdbbaad45e51245b6f9e0743035ade7acf746c6be7" \
|
||||
&& PROTOC_GEN_TARBALL="protoc-gen-go.v1.34.1.linux.amd64.tar.gz" \
|
||||
&& wget -q "https://github.com/protocolbuffers/protobuf-go/releases/download/v1.34.1/${PROTOC_GEN_TARBALL}" \
|
||||
&& echo "${PROTOC_GEN_SHA256} ${PROTOC_GEN_TARBALL}" | sha256sum -c \
|
||||
&& sudo tar -C /usr/local/bin -xzf "${PROTOC_GEN_TARBALL}" \
|
||||
&& rm "${PROTOC_GEN_TARBALL}"
|
||||
|
||||
# Create Nix directory as root.
|
||||
RUN mkdir /nix && chown 1001:1001 /nix
|
||||
|
||||
|
@ -98,6 +114,9 @@ RUN sudo groupadd -g 1001 jenkins \
|
|||
USER jenkins
|
||||
ENV HOME="/home/jenkins"
|
||||
|
||||
# Access to tools installed by Go.
|
||||
ENV PATH="${HOME}/go/bin:${PATH}"
|
||||
|
||||
# Nix for jenkins user to build status-go.
|
||||
RUN curl -s https://nixos.org/releases/nix/nix-2.19.3/install | sh -s -- --no-daemon
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ pipeline {
|
|||
/* Necessary image with Ubuntu 20.04 for older Glibc. */
|
||||
docker {
|
||||
label 'linux'
|
||||
image 'statusteam/nim-status-client-build:1.4.1-qt5.15.2'
|
||||
image 'statusteam/nim-status-client-build:1.5.0-qt5.15.2'
|
||||
/* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */
|
||||
args '--entrypoint="" --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse'
|
||||
}
|
||||
|
@ -66,14 +66,13 @@ pipeline {
|
|||
PLATFORM = "linux/${getArch()}"
|
||||
/* Improve make performance */
|
||||
MAKEFLAGS = "-j4 V=${params.VERBOSE}"
|
||||
/* Makefile assumes the compiler folder is included */
|
||||
QTDIR = "/opt/qt/5.15.2/gcc_64"
|
||||
PATH = "${env.QTDIR}/bin:${env.PATH}"
|
||||
/* Avoid weird bugs caused by stale cache. */
|
||||
QML_DISABLE_DISK_CACHE = "true"
|
||||
/* Control output the filename */
|
||||
STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'AppImage', arch: getArch())}"
|
||||
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz', arch: getArch())}"
|
||||
/* prevent sharing cache dir across different jobs */
|
||||
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
|
|
@ -63,6 +63,8 @@ pipeline {
|
|||
/* Control output the filename */
|
||||
STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'nix.AppImage', arch: getArch())}"
|
||||
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'nix.tar.gz', arch: getArch())}"
|
||||
/* prevent sharing cache dir across different jobs */
|
||||
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
|
|
@ -68,13 +68,15 @@ pipeline {
|
|||
/* WARNING: Qt 5.15.8 installed via Brew. */
|
||||
QTDIR = '/opt/homebrew/opt/qt@5'
|
||||
/* Enforce Go version installed infra-role-golang. */
|
||||
PATH = "${env.QTDIR}/bin:/usr/local/go/bin:${env.PATH}"
|
||||
PATH = "${env.QTDIR}/bin:${env.HOME}/go/bin:/usr/local/go/bin:${env.PATH}"
|
||||
/* Avoid weird bugs caused by stale cache. */
|
||||
QML_DISABLE_DISK_CACHE = "true"
|
||||
/* Control output the filename */
|
||||
STATUS_CLIENT_DMG = "pkg/${utils.pkgFilename(ext: 'dmg', arch: getArch())}"
|
||||
/* Apple Team ID for Notarization */
|
||||
MACOS_NOTARIZE_TEAM_ID = "8B5X2M6H2Y"
|
||||
/* prevent sharing cache dir across different jobs */
|
||||
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
|
|
@ -70,7 +70,7 @@ pipeline {
|
|||
MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE}"
|
||||
/* Explicitly set the QT version */
|
||||
QTDIR = "/c/Qt/5.15.2/msvc2019_64"
|
||||
PATH = "${env.QTDIR}/bin:${env.PATH}"
|
||||
PATH = "${env.QTDIR}/bin:${goPath()}/bin:${env.PATH}"
|
||||
/* Avoid weird bugs caused by stale cache. */
|
||||
QML_DISABLE_DISK_CACHE = "true"
|
||||
/* Control output the filename */
|
||||
|
@ -79,6 +79,8 @@ pipeline {
|
|||
STATUS_CLIENT_7Z = "pkg/${utils.pkgFilename(ext: '7z', arch: getArch())}"
|
||||
/* Hack-fix for params not being set in env on first job run. */
|
||||
WINDOWS_CODESIGN_TIMESTAMP_URL = "${params.WINDOWS_CODESIGN_TIMESTAMP_URL}"
|
||||
/* prevent sharing cache dir across different jobs */
|
||||
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
@ -142,3 +144,7 @@ def getArch() {
|
|||
if (tokens.contains(arch)) { return arch }
|
||||
}
|
||||
}
|
||||
|
||||
def goPath() {
|
||||
return sh(script: 'go env GOPATH', returnStdout: true).trim().replace('C:', '/c')
|
||||
}
|
||||
|
|
|
@ -7,14 +7,19 @@
|
|||
|
||||
final: prev: let
|
||||
inherit (prev) config stdenv callPackage recurseIntoAttrs makeOverridable fetchurl lib writeShellScriptBin __splicedPackages;
|
||||
in rec {
|
||||
linuxdeployqt = callPackage ./pkgs/linuxdeployqt/default.nix { };
|
||||
in {
|
||||
# TODO: Remove once nixpkgs is upgraded.
|
||||
mockgen = callPackage ./pkgs/mockgen { };
|
||||
protobuf3_20 = callPackage ./pkgs/protobuf { };
|
||||
protoc-gen-go = callPackage ./pkgs/protoc-gen-go { };
|
||||
|
||||
linuxdeployqt = callPackage ./pkgs/linuxdeployqt { };
|
||||
|
||||
# Copyied from d9424d2191d6439a276b69ae1fd0a800586135ca
|
||||
# 2018-07-27 -> 2020-12-31
|
||||
# TODO: override and upgrade
|
||||
# Copy is uses because of initial complexity of package override (probably due to fuse override)
|
||||
appimagekit = callPackage ./pkgs/appimagekit/default.nix { };
|
||||
appimagekit = callPackage ./pkgs/appimagekit { };
|
||||
|
||||
# Requirement from Makefile - 3.19
|
||||
cmake_3_19 = prev.cmake.overrideAttrs ( attrs : rec {
|
||||
|
@ -33,6 +38,7 @@ in rec {
|
|||
# TODO: compile, not binary
|
||||
# Binary is used because of initial complexity of both package override and copy from newer nixpkgs
|
||||
go_1_21 = callPackage ./pkgs/go/bootstrap121.nix { };
|
||||
buildGo121Module = callPackage ./pkgs/go-module { go = final.go_1_21; };
|
||||
|
||||
# Fix for linuxdeployqt running ldd from nix with system shell
|
||||
# ERROR: findDependencyInfo: "/bin/sh: /nix/store/HASH-glibc-2.31-74/lib/libc.so.6: version `GLIBC_2.33' not found (required by /bin/sh)\n/bin/sh: /nix/store/0c7c96gikmzv87i7lv3vq5s1cmfjd6zf-glibc-2.31-74/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/sh)"
|
||||
|
|
|
@ -0,0 +1,317 @@
|
|||
{ go, cacert, git, lib, stdenv }:
|
||||
|
||||
{ name ? "${args'.pname}-${args'.version}"
|
||||
, src
|
||||
, nativeBuildInputs ? [ ]
|
||||
, passthru ? { }
|
||||
, patches ? [ ]
|
||||
|
||||
# A function to override the goModules derivation
|
||||
, overrideModAttrs ? (_oldAttrs: { })
|
||||
|
||||
# path to go.mod and go.sum directory
|
||||
, modRoot ? "./"
|
||||
|
||||
# vendorHash is the SRI hash of the vendored dependencies
|
||||
#
|
||||
# if vendorHash is null, then we won't fetch any dependencies and
|
||||
# rely on the vendor folder within the source.
|
||||
, vendorHash ? throw (
|
||||
if args'?vendorSha256 then
|
||||
"buildGoModule: Expect vendorHash instead of vendorSha256"
|
||||
else
|
||||
"buildGoModule: vendorHash is missing"
|
||||
)
|
||||
# Whether to delete the vendor folder supplied with the source.
|
||||
, deleteVendor ? false
|
||||
# Whether to fetch (go mod download) and proxy the vendor directory.
|
||||
# This is useful if your code depends on c code and go mod tidy does not
|
||||
# include the needed sources to build or if any dependency has case-insensitive
|
||||
# conflicts which will produce platform dependant `vendorHash` checksums.
|
||||
, proxyVendor ? false
|
||||
|
||||
# We want parallel builds by default
|
||||
, enableParallelBuilding ? true
|
||||
|
||||
# Do not enable this without good reason
|
||||
# IE: programs coupled with the compiler
|
||||
, allowGoReference ? false
|
||||
|
||||
, CGO_ENABLED ? 1
|
||||
|
||||
, meta ? { }
|
||||
|
||||
# Not needed with buildGoModule
|
||||
, goPackagePath ? ""
|
||||
|
||||
, ldflags ? [ ]
|
||||
|
||||
, GOFLAGS ? [ ]
|
||||
|
||||
# needed for buildFlags{,Array} warning
|
||||
, buildFlags ? ""
|
||||
, buildFlagsArray ? ""
|
||||
|
||||
, ...
|
||||
}@args':
|
||||
|
||||
assert goPackagePath != "" -> throw "`goPackagePath` is not needed with `buildGoModule`";
|
||||
|
||||
let
|
||||
args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "vendorHash" ];
|
||||
|
||||
GO111MODULE = "on";
|
||||
GOTOOLCHAIN = "local";
|
||||
|
||||
goModules = if (vendorHash == null) then "" else
|
||||
(stdenv.mkDerivation {
|
||||
name = "${name}-go-modules";
|
||||
|
||||
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ go git cacert ];
|
||||
|
||||
inherit (args) src;
|
||||
inherit (go) GOOS GOARCH;
|
||||
inherit GO111MODULE GOTOOLCHAIN;
|
||||
|
||||
# The following inheritence behavior is not trivial to expect, and some may
|
||||
# argue it's not ideal. Changing it may break vendor hashes in Nixpkgs and
|
||||
# out in the wild. In anycase, it's documented in:
|
||||
# doc/languages-frameworks/go.section.md
|
||||
prePatch = args.prePatch or "";
|
||||
patches = args.patches or [ ];
|
||||
patchFlags = args.patchFlags or [ ];
|
||||
postPatch = args.postPatch or "";
|
||||
preBuild = args.preBuild or "";
|
||||
postBuild = args.modPostBuild or "";
|
||||
sourceRoot = args.sourceRoot or "";
|
||||
# Commented out due to incomprehensible Nix errors.
|
||||
#env = args.env or { };
|
||||
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
||||
"GIT_PROXY_COMMAND"
|
||||
"SOCKS_SERVER"
|
||||
"GOPROXY"
|
||||
];
|
||||
|
||||
configurePhase = args.modConfigurePhase or ''
|
||||
runHook preConfigure
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
export GOPATH="$TMPDIR/go"
|
||||
cd "${modRoot}"
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = args.modBuildPhase or (''
|
||||
runHook preBuild
|
||||
'' + lib.optionalString deleteVendor ''
|
||||
if [ ! -d vendor ]; then
|
||||
echo "vendor folder does not exist, 'deleteVendor' is not needed"
|
||||
exit 10
|
||||
else
|
||||
rm -rf vendor
|
||||
fi
|
||||
'' + ''
|
||||
if [ -d vendor ]; then
|
||||
echo "vendor folder exists, please set 'vendorHash = null;' in your expression"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
${if proxyVendor then ''
|
||||
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
|
||||
go mod download
|
||||
'' else ''
|
||||
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
||||
goModVendorFlags+=(-v)
|
||||
fi
|
||||
go mod vendor "''${goModVendorFlags[@]}"
|
||||
''}
|
||||
|
||||
mkdir -p vendor
|
||||
|
||||
runHook postBuild
|
||||
'');
|
||||
|
||||
installPhase = args.modInstallPhase or ''
|
||||
runHook preInstall
|
||||
|
||||
${if proxyVendor then ''
|
||||
rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
|
||||
cp -r --reflink=auto "''${GOPATH}/pkg/mod/cache/download" $out
|
||||
'' else ''
|
||||
cp -r --reflink=auto vendor $out
|
||||
''}
|
||||
|
||||
if ! [ "$(ls -A $out)" ]; then
|
||||
echo "vendor folder is empty, please set 'vendorHash = null;' in your expression"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHash = vendorHash;
|
||||
# Handle empty vendorHash; avoid
|
||||
# error: empty hash requires explicit hash algorithm
|
||||
outputHashAlgo = if vendorHash == "" then "sha256" else null;
|
||||
}).overrideAttrs overrideModAttrs;
|
||||
|
||||
package = stdenv.mkDerivation (args // {
|
||||
nativeBuildInputs = [ go ] ++ nativeBuildInputs;
|
||||
|
||||
inherit (go) GOOS GOARCH;
|
||||
|
||||
GOFLAGS = GOFLAGS
|
||||
++ (lib.optional (!proxyVendor) "-mod=vendor")
|
||||
++ (lib.optional (!allowGoReference) "-trimpath");
|
||||
inherit CGO_ENABLED enableParallelBuilding GO111MODULE GOTOOLCHAIN;
|
||||
|
||||
# If not set to an explicit value, set the buildid empty for reproducibility.
|
||||
ldflags = ldflags ++ lib.optional (!lib.any (lib.hasPrefix "-buildid=") ldflags) "-buildid=";
|
||||
|
||||
configurePhase = args.configurePhase or (''
|
||||
runHook preConfigure
|
||||
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
export GOPATH="$TMPDIR/go"
|
||||
export GOPROXY=off
|
||||
export GOSUMDB=off
|
||||
cd "$modRoot"
|
||||
'' + lib.optionalString (vendorHash != null) ''
|
||||
${if proxyVendor then ''
|
||||
export GOPROXY=file://${goModules}
|
||||
'' else ''
|
||||
rm -rf vendor
|
||||
cp -r --reflink=auto ${goModules} vendor
|
||||
''}
|
||||
'' + ''
|
||||
|
||||
# currently pie is only enabled by default in pkgsMusl
|
||||
# this will respect the `hardening{Disable,Enable}` flags if set
|
||||
if [[ $NIX_HARDENING_ENABLE =~ "pie" ]]; then
|
||||
export GOFLAGS="-buildmode=pie $GOFLAGS"
|
||||
fi
|
||||
|
||||
runHook postConfigure
|
||||
'');
|
||||
|
||||
buildPhase = args.buildPhase or ''
|
||||
runHook preBuild
|
||||
|
||||
exclude='\(/_\|examples\|Godeps\|testdata'
|
||||
if [[ -n "$excludedPackages" ]]; then
|
||||
IFS=' ' read -r -a excludedArr <<<$excludedPackages
|
||||
printf -v excludedAlternates '%s\\|' "''${excludedArr[@]}"
|
||||
excludedAlternates=''${excludedAlternates%\\|} # drop final \| added by printf
|
||||
exclude+='\|'"$excludedAlternates"
|
||||
fi
|
||||
exclude+='\)'
|
||||
|
||||
buildGoDir() {
|
||||
local cmd="$1" dir="$2"
|
||||
|
||||
. $TMPDIR/buildFlagsArray
|
||||
|
||||
declare -a flags
|
||||
flags+=($buildFlags "''${buildFlagsArray[@]}")
|
||||
flags+=(''${tags:+-tags=''${tags// /,}})
|
||||
flags+=(''${ldflags:+-ldflags="$ldflags"})
|
||||
flags+=("-p" "$NIX_BUILD_CORES")
|
||||
|
||||
if [ "$cmd" = "test" ]; then
|
||||
flags+=(-vet=off)
|
||||
flags+=($checkFlags)
|
||||
fi
|
||||
|
||||
local OUT
|
||||
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
|
||||
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
||||
echo "$OUT" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$OUT" ]; then
|
||||
echo "$OUT" >&2
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
getGoDirs() {
|
||||
local type;
|
||||
type="$1"
|
||||
if [ -n "$subPackages" ]; then
|
||||
echo "$subPackages" | sed "s,\(^\| \),\1./,g"
|
||||
else
|
||||
find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort --unique | grep -v "$exclude"
|
||||
fi
|
||||
}
|
||||
|
||||
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
||||
buildFlagsArray+=(-x)
|
||||
fi
|
||||
|
||||
if [ ''${#buildFlagsArray[@]} -ne 0 ]; then
|
||||
declare -p buildFlagsArray > $TMPDIR/buildFlagsArray
|
||||
else
|
||||
touch $TMPDIR/buildFlagsArray
|
||||
fi
|
||||
if [ -z "$enableParallelBuilding" ]; then
|
||||
export NIX_BUILD_CORES=1
|
||||
fi
|
||||
for pkg in $(getGoDirs ""); do
|
||||
echo "Building subPackage $pkg"
|
||||
buildGoDir install "$pkg"
|
||||
done
|
||||
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||
# normalize cross-compiled builds w.r.t. native builds
|
||||
(
|
||||
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
|
||||
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
|
||||
mv $dir/* $dir/..
|
||||
fi
|
||||
if [[ -d $dir ]]; then
|
||||
rmdir $dir
|
||||
fi
|
||||
)
|
||||
'' + ''
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
doCheck = args.doCheck or true;
|
||||
checkPhase = args.checkPhase or ''
|
||||
runHook preCheck
|
||||
# We do not set trimpath for tests, in case they reference test assets
|
||||
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
||||
|
||||
for pkg in $(getGoDirs test); do
|
||||
buildGoDir test "$pkg"
|
||||
done
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = args.installPhase or ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
dir="$GOPATH/bin"
|
||||
[ -e "$dir" ] && cp -r $dir $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
disallowedReferences = lib.optional (!allowGoReference) go;
|
||||
|
||||
passthru = passthru // { inherit go goModules vendorHash; };
|
||||
|
||||
meta = {
|
||||
# Add default meta information
|
||||
platforms = go.meta.platforms or lib.platforms.all;
|
||||
} // meta;
|
||||
});
|
||||
in
|
||||
package
|
|
@ -4,17 +4,15 @@ let
|
|||
if platform.isDarwin then "darwin"
|
||||
else platform.parsed.kernel.name;
|
||||
|
||||
toGoCPU = platform: {
|
||||
"i686" = "386";
|
||||
"x86_64" = "amd64";
|
||||
goarch = platform: {
|
||||
"aarch64" = "arm64";
|
||||
"armv6l" = "armv6l";
|
||||
"armv7l" = "armv6l";
|
||||
"powerpc64le" = "ppc64le";
|
||||
"riscv64" = "riscv64";
|
||||
}.${platform.parsed.cpu.name} or (throw "Unsupported CPU ${platform.parsed.cpu.name}");
|
||||
"arm" = "arm";
|
||||
"armv6l" = "arm";
|
||||
"armv7l" = "arm";
|
||||
"x86_64" = "amd64";
|
||||
}.${platform.parsed.cpu.name} or (throw "Unsupported system: ${platform.parsed.cpu.name}");
|
||||
|
||||
toGoPlatform = platform: "${toGoKernel platform}-${toGoCPU platform}";
|
||||
toGoPlatform = platform: "${toGoKernel platform}-${goarch platform}";
|
||||
|
||||
platform = toGoPlatform stdenv.hostPlatform;
|
||||
in
|
||||
|
@ -38,4 +36,7 @@ stdenv.mkDerivation rec {
|
|||
ln -s $out/share/go/bin/go $out/bin/go
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
GOOS = stdenv.targetPlatform.parsed.kernel.name;
|
||||
GOARCH = goarch stdenv.targetPlatform;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{ buildGo121Module, fetchFromGitHub, lib }:
|
||||
|
||||
buildGo121Module rec {
|
||||
pname = "mockgen";
|
||||
version = "0.4.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "uber-go";
|
||||
repo = "mock";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-3nt70xrZisK5vgQa+STZPiY4F9ITKw8PbBWcKoBn4Vc=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-mcNVud2jzvlPPQEaar/eYZkP71V2Civz+R5v10+tewA=";
|
||||
|
||||
CGO_ENABLED = 0;
|
||||
|
||||
subPackages = [ "mockgen" ];
|
||||
|
||||
ldflags = [
|
||||
"-X=main.version=${version}"
|
||||
"-X=main.date=1970-01-01T00:00:00Z"
|
||||
"-X=main.commit=unknown"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "GoMock is a mocking framework for the Go programming language";
|
||||
homepage = "https://github.com/uber-go/mock";
|
||||
changelog = "https://github.com/uber-go/mock/blob/v${version}/CHANGELOG.md";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ bouk ];
|
||||
mainProgram = "mockgen";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
{ lib, stdenv, fetchFromGitHub, autoreconfHook, zlib, gtest, buildPackages }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "protobuf";
|
||||
version = "3.20.3";
|
||||
|
||||
# make sure you test also -A pythonPackages.protobuf
|
||||
src = fetchFromGitHub {
|
||||
owner = "protocolbuffers";
|
||||
repo = "protobuf";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-u/1Yb8+mnDzc3OwirpGESuhjkuKPgqDAvlgo3uuzbbk=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
rm -rf gmock
|
||||
cp -r ${gtest.src}/googlemock gmock
|
||||
cp -r ${gtest.src}/googletest googletest
|
||||
chmod -R a+w gmock
|
||||
chmod -R a+w googletest
|
||||
ln -s ../googletest gmock/gtest
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace src/google/protobuf/testing/googletest.cc \
|
||||
--replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc ];
|
||||
|
||||
buildInputs = [ zlib ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
meta = {
|
||||
description = "Google's data interchange format";
|
||||
longDescription =
|
||||
''Protocol Buffers are a way of encoding structured data in an efficient
|
||||
yet extensible format. Google uses Protocol Buffers for almost all of
|
||||
its internal RPC protocols and file formats.
|
||||
'';
|
||||
homepage = "https://developers.google.com/protocol-buffers/";
|
||||
license = lib.licenses.bsd3;
|
||||
mainProgram = "protoc";
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
{ lib, stdenv
|
||||
, fetchFromGitHub
|
||||
, autoreconfHook, zlib, gtest, buildPackages
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation {
|
||||
pname = "protobuf";
|
||||
version = "3.20.3";
|
||||
sha256 = "sha256-u/1Yb8+mnDzc3OwirpGESuhjkuKPgqDAvlgo3uuzbbk=";
|
||||
|
||||
# make sure you test also -A pythonPackages.protobuf
|
||||
src = fetchFromGitHub {
|
||||
owner = "protocolbuffers";
|
||||
repo = "protobuf";
|
||||
rev = "v${version}";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
rm -rf gmock
|
||||
cp -r ${gtest.src}/googlemock gmock
|
||||
cp -r ${gtest.src}/googletest googletest
|
||||
chmod -R a+w gmock
|
||||
chmod -R a+w googletest
|
||||
ln -s ../googletest gmock/gtest
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace src/google/protobuf/testing/googletest.cc \
|
||||
--replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ];
|
||||
|
||||
buildInputs = [ zlib ];
|
||||
configureFlags = lib.optional (buildProtobuf != null) "--with-protoc=${buildProtobuf}/bin/protoc";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
meta = {
|
||||
description = "Google's data interchange format";
|
||||
longDescription =
|
||||
''Protocol Buffers are a way of encoding structured data in an efficient
|
||||
yet extensible format. Google uses Protocol Buffers for almost all of
|
||||
its internal RPC protocols and file formats.
|
||||
'';
|
||||
homepage = "https://developers.google.com/protocol-buffers/";
|
||||
license = lib.licenses.bsd3;
|
||||
mainProgram = "protoc";
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
};
|
||||
in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform)
|
||||
then (mkProtobufDerivation null buildPackages.stdenv)
|
||||
else null) stdenv
|
|
@ -0,0 +1,27 @@
|
|||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib buildGo121Module fetchFromGitHub;
|
||||
in buildGo121Module rec {
|
||||
pname = "protoc-gen-go";
|
||||
version = "1.34.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "protocolbuffers";
|
||||
repo = "protobuf-go";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-xbfqN/t6q5dFpg1CkxwxAQkUs8obfckMDqytYzuDwF4=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-nGI/Bd6eMEoY0sBwWEtyhFowHVvwLKjbT4yfzFz6Z3E=";
|
||||
|
||||
subPackages = [ "cmd/protoc-gen-go" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Go support for Google's protocol buffers";
|
||||
mainProgram = "protoc-gen-go";
|
||||
homepage = "https://google.golang.org/protobuf";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ jojosch ];
|
||||
};
|
||||
}
|
|
@ -15,7 +15,7 @@ function check_version {
|
|||
|
||||
function install_build_dependencies {
|
||||
echo "Install build dependencies"
|
||||
brew install cmake pkg-config libtool jq node@18 yarn
|
||||
brew install cmake pkg-config libtool jq node@18 yarn protoc-gen-go
|
||||
}
|
||||
|
||||
function install_qt {
|
||||
|
|
|
@ -15,9 +15,10 @@ function check_version {
|
|||
function install_build_dependencies {
|
||||
echo "Install build dependencies"
|
||||
apt update
|
||||
apt install -yq git build-essential pkg-config mesa-common-dev unixodbc-dev libpq-dev \
|
||||
libglu1-mesa-dev wget libpcsclite-dev libpcre3-dev libssl-dev libpulse-mainloop-glib0 \
|
||||
libxkbcommon-x11-dev extra-cmake-modules cmake
|
||||
apt install -yq git wget build-essential \
|
||||
cmake extra-cmake-modules pkg-config protoc-gen-go \
|
||||
mesa-common-dev unixodbc-dev libpq-dev libglu1-mesa-dev libpcsclite-dev \
|
||||
libpcre3-dev libssl-dev libpulse-mainloop-glib0 libxkbcommon-x11-dev
|
||||
}
|
||||
|
||||
function install_release_dependencies {
|
||||
|
@ -87,7 +88,7 @@ SUCCESS!
|
|||
Before you attempt to build status-dektop you'll need a few environment variables set:
|
||||
|
||||
export QTDIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64
|
||||
export PATH=\$QTDIR:\$QTDIR/bin:\$PATH
|
||||
export PATH=\$QTDIR:\$QTDIR/bin:\$(go env GOPATH)\bin:$PATH
|
||||
"
|
||||
echo $msg
|
||||
}
|
||||
|
|
|
@ -12,6 +12,21 @@ function Install-Scoop {
|
|||
}
|
||||
}
|
||||
|
||||
# Install Protobuf tool necessary to generate status-go files.
|
||||
function Install-Protobuf-Go {
|
||||
$ProtocGenVersion = "v1.34.1"
|
||||
$ProtocGenZIP = "protoc-gen-go.$ProtocGenVersion.windows.amd64.zip"
|
||||
$ProtocGenURL = "https://github.com/protocolbuffers/protobuf-go/releases/download/$ProtocGenVersion/$ProtocGenZIP"
|
||||
$ProtocGenSHA256 = "403a619c4698fe5c4162c7f855803de3e8d8e0c187d7d51cbeb8d599f7a5a073"
|
||||
(New-Object System.Net.WebClient).DownloadFile($ProtocGenURL, "$env:USERPROFILE\$ProtocGenZIP")
|
||||
$ProtocGenRealSHA256 = (Get-Filehash -algorithm SHA256 "$env:USERPROFILE\$ProtocGenZIP").Hash
|
||||
if ($ProtocGenRealSHA256 -ne $ProtocGenSHA256) {
|
||||
throw "SHA256 hash does not match for $ProtocGenZIP !"
|
||||
}
|
||||
New-Item "$env:USERPROFILE\go\bin" -ItemType Directory -ea 0
|
||||
7z x -o="$env:USERPROFILE\go\bin" -y "$env:USERPROFILE\$ProtocGenZIP"
|
||||
}
|
||||
|
||||
# Install Git and other dependencies
|
||||
function Install-Dependencies {
|
||||
Write-Host "Installing dependencies..."
|
||||
|
@ -19,6 +34,7 @@ function Install-Dependencies {
|
|||
scoop bucket add extras
|
||||
}
|
||||
scoop install --global go@1.21.10
|
||||
scoop install --global protobuf@3.20.0
|
||||
scoop install --global vcredist2022
|
||||
scoop install --global `
|
||||
7zip git dos2unix findutils `
|
||||
|
@ -70,6 +86,7 @@ export VCINSTALLDIR="/c/BuildTools/VC"
|
|||
|
||||
You might also have to include the following paths in your `$PATH:
|
||||
|
||||
export PATH=`"$env:USERPROFILE/go/bin:`$PATH`"
|
||||
export PATH=`"/c/BuildTools/MSBuild/Current/Bin:`$PATH`"
|
||||
export PATH=`"/c/BuildTools/VC/Tools/MSVC/14.29.30133/bin:`$PATH`"
|
||||
export PATH=`"/c/ProgramData/scoop/apps/inno-setup/current:`$PATH`"
|
||||
|
@ -87,6 +104,7 @@ $QtVersion = "5.15.2"
|
|||
If ($MyInvocation.InvocationName -ne ".") {
|
||||
Install-Scoop
|
||||
Install-Dependencies
|
||||
Install-Protobuf-Go
|
||||
Install-Qt-SDK
|
||||
Install-VC-BuildTools
|
||||
Show-Success-Message
|
||||
|
|
|
@ -29,7 +29,7 @@ in pkgs.mkShell {
|
|||
linuxdeployqt appimagekit
|
||||
libglvnd # TODO: Qt 5.15.2 fix, review after upgrade
|
||||
cmake_3_19 gnumake pkg-config gnugrep qtCustom
|
||||
go_1_21
|
||||
go_1_21 go-bindata mockgen protobuf3_20 protoc-gen-go
|
||||
pcre nss pcsclite extra-cmake-modules
|
||||
xorg.libxcb xorg.libX11 libxkbcommon
|
||||
] ++ (with gst_all_1; [
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e8e6ef352b80c3a98572e48147384fe76f813b52
|
||||
Subproject commit ba37c32c07d1b05a94d1c7f7cb1b38fb82730f7b
|
Loading…
Reference in New Issue