chore: set gowaku build tags for status-go

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Richard Ramos 2022-11-08 09:17:38 -04:00 committed by Jakub
parent a1c1be8f8a
commit 0f6022a731
3 changed files with 21 additions and 12 deletions

View File

@ -20,7 +20,11 @@ buildGoPackage {
# Build the Go library # Build the Go library
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
go build -buildmode=c-archive -o $out/libstatus.a $NIX_BUILD_TOP/main.go go build \
-buildmode='c-archive' \
-tags='gowaku_skip_migrations' \
-o "$out/libstatus.a" \
$NIX_BUILD_TOP/main.go
runHook postBuild runHook postBuild
''; '';
} }

View File

@ -11,6 +11,9 @@
let let
inherit (lib) concatStringsSep optionalString optional; inherit (lib) concatStringsSep optionalString optional;
isIOS = platform == "ios";
isAndroid = platform == "android";
in buildGoPackage { in buildGoPackage {
pname = source.repo; pname = source.repo;
version = "${source.cleanVersion}-${source.shortRev}-${platform}"; version = "${source.cleanVersion}-${source.shortRev}-${platform}";
@ -20,30 +23,32 @@ in buildGoPackage {
# Sandbox causes Xcode issues on MacOS. Requires sandbox=relaxed. # Sandbox causes Xcode issues on MacOS. Requires sandbox=relaxed.
# https://github.com/status-im/status-mobile/pull/13912 # https://github.com/status-im/status-mobile/pull/13912
__noChroot = (platform == "ios"); __noChroot = isIOS;
extraSrcPaths = [ gomobile ]; extraSrcPaths = [ gomobile ];
nativeBuildInputs = [ gomobile removeReferencesTo ] nativeBuildInputs = [ gomobile removeReferencesTo ]
++ optional (platform == "android") openjdk ++ optional isAndroid openjdk
++ optional (platform == "ios") xcodeWrapper; ++ optional isIOS xcodeWrapper;
ldflags = concatStringsSep " " goBuildLdFlags; ldflags = concatStringsSep " " goBuildLdFlags;
ANDROID_HOME = optionalString (platform == "android") androidPkgs.sdk; ANDROID_HOME = optionalString isAndroid androidPkgs.sdk;
# Ensure XCode is present for iOS, instead of failing at the end of the build. # Ensure XCode is present for iOS, instead of failing at the end of the build.
preConfigure = optionalString (platform == "ios") utils.enforceXCodeAvailable; preConfigure = optionalString isIOS utils.enforceXCodeAvailable;
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
echo -e "\nBuilding $pname for: ${concatStringsSep "," targets}" echo -e "\nBuilding $pname for: ${concatStringsSep "," targets}"
set -x
gomobile bind \ gomobile bind \
${concatStringsSep " " goBuildFlags} \ ${concatStringsSep " " goBuildFlags} \
-ldflags="$ldflags" \ -ldflags="$ldflags" \
-target=${concatStringsSep "," targets} \ -target=${concatStringsSep "," targets} \
${optionalString (platform == "android") "-androidapi=${platformVersion}"} \ ${optionalString isAndroid "-androidapi=${platformVersion}" } \
${optionalString (platform == "ios") "-iosversion=${platformVersion}"} \ ${optionalString isIOS "-iosversion=${platformVersion}" } \
-tags='${optionalString isIOS "nowatchdog"} gowaku_skip_migrations' \
-o ${outputFileName} \ -o ${outputFileName} \
${source.goPackagePath}/mobile ${source.goPackagePath}/mobile
@ -58,7 +63,7 @@ in buildGoPackage {
# Drop govers from disallowedReferences. # Drop govers from disallowedReferences.
dontRenameImports = true; dontRenameImports = true;
# Replace hardcoded paths to go package in /nix/store. # Replace hardcoded paths to go package in /nix/store.
preFixup = optionalString (platform == "ios") '' preFixup = optionalString isIOS ''
find $out -type f -exec \ find $out -type f -exec \
remove-references-to -t $disallowedReferences '{}' + || true remove-references-to -t $disallowedReferences '{}' + || true
''; '';

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "bfab85f73bfa727db5b6e8078f9ce9ec191161ca", "version": "91aac3cec0c1d74f09cf8d108105ba311552723d",
"commit-sha1": "bfab85f73bfa727db5b6e8078f9ce9ec191161ca", "commit-sha1": "91aac3cec0c1d74f09cf8d108105ba311552723d",
"src-sha256": "184zcv531cgwdg7zr7ryav7w9qwd90jgqb9nmmhy4l2pmcm1mlc9" "src-sha256": "0j9vl7alb4rf3zk0bak12s3bdfwgih4fq9yaw7wkinmz03rqx2wg"
} }