2019-05-02 18:13:16 +00:00
|
|
|
|
2019-05-17 08:55:24 +00:00
|
|
|
{ stdenv, utils, callPackage,
|
|
|
|
buildGoPackage, go, xcodeWrapper }:
|
2019-05-02 18:13:16 +00:00
|
|
|
|
|
|
|
{ owner, repo, rev, version, goPackagePath, src, host,
|
2019-05-06 14:52:02 +00:00
|
|
|
|
|
|
|
# desktop-only arguments
|
2019-05-02 18:13:16 +00:00
|
|
|
goBuildFlags, goBuildLdFlags,
|
|
|
|
outputFileName,
|
|
|
|
hostSystem } @ args':
|
|
|
|
|
|
|
|
let
|
2019-05-17 08:55:24 +00:00
|
|
|
buildStatusGo = callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; };
|
2019-05-02 18:13:16 +00:00
|
|
|
|
2019-05-06 14:52:02 +00:00
|
|
|
args = removeAttrs args' [ "goBuildFlags" "goBuildLdFlags" "outputFileName" "hostSystem" ]; # Remove desktop-only arguments from args
|
2019-05-02 18:13:16 +00:00
|
|
|
buildStatusGoDesktopLib = buildStatusGo (args // {
|
2019-05-06 14:52:02 +00:00
|
|
|
buildMessage = "Building desktop library";
|
|
|
|
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
2019-05-02 18:13:16 +00:00
|
|
|
buildPhase = ''
|
|
|
|
pushd "$NIX_BUILD_TOP/go/src/${goPackagePath}" >/dev/null
|
|
|
|
|
|
|
|
go build -o $out/${outputFileName} ${goBuildFlags} -buildmode=c-archive ${goBuildLdFlags} ./lib
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/lib/${hostSystem} $out/include
|
|
|
|
mv $out/${outputFileName} $out/lib/${hostSystem}
|
|
|
|
mv $out/libstatus.h $out/include
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" ];
|
|
|
|
|
|
|
|
meta = {
|
2019-06-04 16:50:29 +00:00
|
|
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
2019-05-02 18:13:16 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
in buildStatusGoDesktopLib
|