Skip to content

Commit

Permalink
nix: fix md5sum on MacOS
Browse files Browse the repository at this point in the history
The default on MacOS is `md5`, while Nix only has `md5sum` available.
Therefore, make it possible to override the variable via the environment
so that flake.nix can set the correct binary name.
  • Loading branch information
aykevl committed Oct 15, 2023
1 parent 46c768e commit 011fba2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ export GOROOT = $(shell $(GO) env GOROOT)
# Flags to pass to go test.
GOTESTFLAGS ?=

# md5sum binary
MD5SUM = md5sum

# tinygo binary for tests
TINYGO ?= $(call detect,tinygo,tinygo $(CURDIR)/build/tinygo)

Expand Down Expand Up @@ -130,21 +127,24 @@ ifeq ($(OS),Windows_NT)
USE_SYSTEM_BINARYEN ?= 1

else ifeq ($(shell uname -s),Darwin)
MD5SUM = md5
MD5SUM ?= md5

CGO_LDFLAGS += -lxar

USE_SYSTEM_BINARYEN ?= 1

else ifeq ($(shell uname -s),FreeBSD)
MD5SUM = md5
MD5SUM ?= md5
START_GROUP = -Wl,--start-group
END_GROUP = -Wl,--end-group
else
START_GROUP = -Wl,--start-group
END_GROUP = -Wl,--end-group
endif

# md5sum binary default, can be overridden by an environment variable
MD5SUM ?= md5sum

# Libraries that should be linked in for the statically linked Clang.
CLANG_LIB_NAMES = clangAnalysis clangAST clangASTMatchers clangBasic clangCodeGen clangCrossTU clangDriver clangDynamicASTMatchers clangEdit clangExtractAPI clangFormat clangFrontend clangFrontendTool clangHandleCXX clangHandleLLVM clangIndex clangLex clangParse clangRewrite clangRewriteFrontend clangSema clangSerialization clangSupport clangTooling clangToolingASTDiff clangToolingCore clangToolingInclusions
CLANG_LIBS = $(START_GROUP) $(addprefix -l,$(CLANG_LIB_NAMES)) $(END_GROUP) -lstdc++
Expand Down
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
export LLVM_AR=llvm-ar
export LLVM_NM=llvm-nm
# Make `make smoketest` work (the default is `md5`, while Nix only
# has `md5sum`).
export MD5SUM=md5sum
# Ugly hack to make the Clang resources directory available.
export GOFLAGS="\"-ldflags=-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=${llvmPackages_16.clang.cc.lib}/lib/clang/16"\"
'';
Expand Down

0 comments on commit 011fba2

Please sign in to comment.