mirror of
https://github.com/status-im/status-react.git
synced 2025-01-13 04:24:40 +00:00
Jakub Sokołowski
42fb40476c
Changes: - Fixed `nix/status-go/desktop` builds - Dropped nimbus wrapper for `status-go` for now - Split `status-go` builds into subfolders: `mobile`, `desktop` - Fixed shells for desktop builds: `linux`,`macos`,`windows` - Added `make status-go-*` targets for building them - Moved source management to `nix/status-go/source.nix` - Moved `nix/status-go/build.nix` into `nix/status-go/mobile` - Moved `nix/desktop/cmake/qtkeychain` to `nix/pkgs/qtkeychain-src` - Moved `nix/desktop/linux/linuxdeployqt` to `nix/pkgs` - Moved `nix/desktop/linux/appimagekit` to `nix/pkgs` - Dropped `nix/tools/mkShell.nix` since it did almost nothing - Dropped `nix/desktop/cmake/snorenotify` since it's broken - Moved setup from `nix/tools/mkShell.nix` to `nix/shells.nix` - Simplified `nix/mobile/ios/status-go-shell.nix` - Simplified `nix/status-go/default.nix` - Updated the `nix/DETAILS.md` and `nix/README.md` - Moved known issues to `nix/KNOWN_ISSUES.md` - Improved output of `nix/scripts/build.sh` Signed-off-by: Jakub Sokołowski <jakub@status.im>
61 lines
1.7 KiB
Nix
61 lines
1.7 KiB
Nix
{ lib, stdenv, utils, go, buildGoPackage
|
|
# object with source attributes
|
|
, meta , source
|
|
, goBuildFlags
|
|
, goBuildLdFlags
|
|
, outputFileName ? "libstatus.a" }:
|
|
|
|
let
|
|
inherit (lib) concatStringsSep optionalString concatMapStrings;
|
|
|
|
removeReferences = [ go ];
|
|
removeExpr = refs: ''remove-references-to ${concatMapStrings (ref: " -t ${ref}") refs}'';
|
|
|
|
hostSystem = stdenv.hostPlatform.system;
|
|
|
|
in buildGoPackage {
|
|
pname = source.repo;
|
|
version = "${source.cleanVersion}-${source.shortRev}";
|
|
|
|
inherit meta;
|
|
inherit (source) src goPackagePath;
|
|
|
|
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
# Ensure XCode is present, instead of failing at the end of the build
|
|
preConfigure = optionalString stdenv.isDarwin utils.enforceXCodeAvailable;
|
|
|
|
buildMessage = "Building desktop library";
|
|
|
|
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
|
buildPhase = let
|
|
CGO_LDFLAGS = concatStringsSep " " goBuildLdFlags;
|
|
in ''
|
|
pushd "$NIX_BUILD_TOP/go/src/${source.goPackagePath}" >/dev/null
|
|
|
|
export GO111MODULE=off
|
|
|
|
go build -o $out/${outputFileName} \
|
|
${concatStringsSep " " goBuildFlags} \
|
|
-buildmode=c-archive \
|
|
-ldflags='${CGO_LDFLAGS}' \
|
|
./lib
|
|
|
|
popd >/dev/null
|
|
'';
|
|
|
|
# replace hardcoded paths to go package in /nix/store, otherwise Nix will fail the build
|
|
fixupPhase = ''
|
|
find $out -type f -exec ${removeExpr removeReferences} '{}' + || true
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/lib/${hostSystem} $out/include
|
|
mv $out/${outputFileName} $out/lib/${hostSystem}
|
|
mv $out/libstatus.h $out/include
|
|
'';
|
|
|
|
outputs = [ "out" ];
|
|
}
|