Skip to content

Commit

Permalink
Merge branch 'update-build'
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarteberg committed Jan 9, 2022
2 parents 3083238 + ad64e24 commit 275f1c5
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 24 deletions.
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ifndef GOPATH
$(error GOPATH must be defined)
$(error GOPATH must be defined)
endif

# When building in the context of the conda-recipe,
Expand Down Expand Up @@ -34,12 +34,20 @@ endif

DVID_TAGS = ${DVID_BACKENDS}
ifdef DVID_LOW_MEMORY
DVID_TAGS += lowmem
DVID_TAGS += lowmem
endif

export CGO_CFLAGS = -I${CONDA_PREFIX}/include
export CGO_LDFLAGS = -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib

ifeq ($(shell uname -s),Darwin)
ifdef MACOSX_DEPLOYMENT_TARGET
$(info MACOSX_DEPLOYMENT_TARGET is ${MACOSX_DEPLOYMENT_TARGET})
export CGO_CFLAGS += -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}
export CGO_LDFLAGS += -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}
endif
endif

# In a Makefile, the first listed target is
# the default target for a bare 'make' command:
all: dvid dvid-backup dvid-transfer
Expand Down Expand Up @@ -72,11 +80,17 @@ DVID_SOURCES = $(shell find . -name "*.go")

HEADERPATH :=
ifneq ($(OS),Windows_NT)
ifeq ($(shell uname -s),Darwin)
HEADERPATH=$(shell xcrun --sdk macosx --show-sdk-path)
endif
ifeq ($(shell uname -s),Darwin)
ifeq (${CONDA_BUILD_SYSROOT},)
HEADERPATH=$(shell xcrun --sdk macosx --show-sdk-path)
else
HEADERPATH := ${CONDA_BUILD_SYSROOT}
endif
endif
endif

$(info HEADERPATH is $(HEADERATH))

bin/dvid: export SDKROOT=$(HEADERPATH)
bin/dvid: cmd/dvid/main.go server/version.go .last-build-git-description ${DVID_SOURCES}
go env -w CGO_ENABLED=1
Expand All @@ -96,11 +110,11 @@ DVID_GO = github.com/janelia-flyem/dvid
DVID_PACKAGES = ${DVID_GO}/dvid/... ${DVID_GO}/storage/... ${DVID_GO}/datastore ${DVID_GO}/server ${DVID_GO}/datatype/... ${DVID_GO}/tests_integration

ifdef PACKAGES
DVID_PACKAGES = ${DVID_GO}/${PACKAGES}
DVID_PACKAGES = ${DVID_GO}/${PACKAGES}
endif

ifdef TEST
SPECIFIC_TEST = -test.run ${TEST}
SPECIFIC_TEST = -test.run ${TEST}
endif

test: dvid
Expand Down
6 changes: 6 additions & 0 deletions scripts/conda-recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ echo "******************"
echo "GOROOT: ${GOROOT}"
echo "******************"


if [ "$(uname)" == "Darwin" ]; then
echo "CONDA_BUILD_SYSROOT: ${CONDA_BUILD_SYSROOT}"
echo "MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET}"
fi

# The dvid repo was cloned to the appropriate internal directory
DVID_REPO=${GOPATH}/src/github.com/janelia-flyem/dvid
cd ${DVID_REPO}
Expand Down
12 changes: 6 additions & 6 deletions scripts/conda-recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
librdkafka:
- 1.3.0
lz4_c:
- 1.9.2
- 1.9.3

pin_run_as_build:
librdkafka:
Expand All @@ -21,7 +21,7 @@ pin_run_as_build:

CONDA_BUILD_SYSROOT:
# Most conda-forge packages are compatible with MacOSX 10.9,
# but golang requires at least MacOSX 10.10
# but golang-1.16 requires at least MacOSX 10.12
#
# You will have to install this SDK manually, via this project:
#
Expand All @@ -31,10 +31,10 @@ CONDA_BUILD_SYSROOT:
#
# curl https://raw.githubusercontent.com/devernay/xcodelegacy/master/XcodeLegacy.sh > XcodeLegacy.sh
# chmod +x XcodeLegacy.sh
# sudo ./XcodeLegacy.sh -osx1010 buildpackages
# sudo ./XcodeLegacy.sh -osx1010 install
# sudo ./XcodeLegacy.sh -osx1012 buildpackages
# sudo ./XcodeLegacy.sh -osx1012 install
#
- /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
- /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk

MACOSX_DEPLOYMENT_TARGET:
- 10.10
- 10.12
11 changes: 3 additions & 8 deletions scripts/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,10 @@ requirements:
# are used to build dvid, but are not linked against
# or incorporated into the executable in any way.
build:
- go-cgo=1.16

# - go=1.12 # From flyem-forge, not conda-forge!
- go=1.12 # From flyem-forge, not conda-forge!

# Anaconda's gcc build -- on Linux only for now
# (getting their clang binary to work on recent versions of MacOS is
# tricky for some reason, related to SDK versions, etc.)
- {{ compiler('c') }} # [linux]
- {{ compiler('cxx') }} # [linux]
- {{ compiler('c') }}
- {{ compiler('cxx') }}

- pkg-config

Expand Down
7 changes: 4 additions & 3 deletions scripts/install-developer-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ cd ${THIS_SCRIPT_DIR}
#GO_VERSION=1.16.10

if [[ $(uname) == "Darwin" ]]; then
# Force MacOS builds to use current Xcode rather than download.
echo "Note that XCode should be installed independently and command line tools like xcrun available."
COMPILER_PACKAGE=clangxx_linux-64
else
COMPILER_PACKAGE=gxx_linux-64
fi

CMD="conda install -y -c flyem-forge -c conda-forge snappy basholeveldb lz4-c 'librdkafka=1.3.0' go-cgo pkg-config ${COMPILER_PACKAGE}"


CMD="conda install -y -c flyem-forge -c conda-forge clangxx_osx-64 snappy basholeveldb lz4-c 'librdkafka=1.3.0' go-cgo pkg-config ${COMPILER_PACKAGE}"
echo ${CMD}
${CMD}

Expand Down

0 comments on commit 275f1c5

Please sign in to comment.