Skip to content

Commit

Permalink
build: separate externals into their own project
Browse files Browse the repository at this point in the history
Move external packages including ceph into a separate project under
the externals subdir.
  • Loading branch information
bassam committed Mar 6, 2017
1 parent f65c8ed commit 6e84b16
Show file tree
Hide file tree
Showing 41 changed files with 341 additions and 349 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/.glide
/.work
/.external

/bin
/tools
Expand All @@ -18,4 +17,4 @@ demo/standalone/cloud-config.yml

.virtualbox/

.discovery-token
.discovery-token
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "ceph"]
path = ceph
url = https://github.com/rook/ceph.git
[submodule "external/src/ceph"]
path = external/src/ceph
url = https://github.com/rook/ceph
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ try {
checkout scm
sh "git submodule sync --recursive"
sh "git submodule update --init --recursive"
sh "build/ceph-submodule-check"
sh "external/ceph-submodule-check"
}

stage('Build') {
sh "CCACHE_DIR=${CCACHE_DIR} VERSION=${VERSION} build/run make -C external -j${parallel} cross"
sh "CCACHE_DIR=${CCACHE_DIR} VERSION=${VERSION} build/run make -j${parallel} release"
}

Expand Down
74 changes: 17 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,6 @@ $(error PIE only supported with dynamic linking. Set LINKMODE=dynamic or LINKMOD
endif
endif

# if DEBUG is set to 1 the binaries will not be optimized
# enabling easier debugging with gdb. Note that debug symbols
# are always generated wether DEBUG is 0 or 1.
DEBUG ?= 0

# the memory allocator to use for cephd
ALLOCATOR ?= tcmalloc
ifeq ($(ALLOCATOR),jemalloc)
CEPHD_ALLOCATOR = jemalloc
TAGS += jemalloc
else
ifeq ($(ALLOCATOR),tcmalloc)
CEPHD_ALLOCATOR = tcmalloc_minimal
TAGS += tcmalloc
else
ifeq ($(ALLOCATOR),libc)
CEPHD_ALLOCATOR = libc
endif
endif
endif

# whether to use ccache when building cephd
CCACHE ?= 1

# turn on more verbose build
V ?= 0
ifeq ($(V),1)
Expand Down Expand Up @@ -110,53 +86,41 @@ endif
LDFLAGS += -X $(GO_PROJECT)/pkg/version.Version=$(VERSION)

# ====================================================================================
# Setup rookd
# Setup Go projects

# support for cross compiling
include build/makelib/cross.mk

ifeq ($(GOOS)_$(GOARCH),linux_amd64)
ROOKD_SUPPORTED := 1
endif

ifeq ($(GOOS)_$(GOARCH),linux_arm64)
ROOKD_SUPPORTED := 1
endif

ifeq ($(ROOKD_SUPPORTED),1)

CEPHD_DEBUG = $(DEBUG)
CEPHD_CCACHE = $(CCACHE)
CEPHD_BUILD_DIR = $(WORKDIR)/ceph
CEPHD_PLATFORM = $(GOOS)_$(GOARCH)

# go does not check dependencies listed in LDFLAGS. we touch the dummy source file
# to force go to rebuild cephd
CEPHD_TOUCH_ON_BUILD = pkg/cephmgr/cephd/dummy.cc
ifeq ($(GOOS),linux)

CGO_LDFLAGS = -L$(abspath $(CEPHD_BUILD_DIR)/$(CEPHD_PLATFORM)/lib)
CGO_PREREQS = cephd.build
# Set the memory allocator used for ceph
ALLOCATOR ?= tcmalloc_minimal

include build/makelib/cephd.mk
ifeq ($(ALLOCATOR),jemalloc)
TAGS += jemalloc
else
ifeq ($(ALLOCATOR),tcmalloc_minimal)
TAGS += tcmalloc_minimal
else
endif
endif

clean: cephd.clean
# Set the cgo flags to link externals
CGO_CFLAGS = -I$(abspath external/build/$(CROSS_TRIPLE)/include)
CGO_LDFLAGS = -L$(abspath external/build/$(CROSS_TRIPLE)/lib)

endif

# ====================================================================================
# Setup Go projects

GO_WORK_DIR = $(WORKDIR)
GO_BIN_DIR = $(BIN_DIR)

ifeq ($(LINKMODE),static)
GO_STATIC_PACKAGES=$(GO_PROJECT)
ifeq ($(ROOKD_SUPPORTED),1)
ifeq ($(GOOS),linux)
GO_STATIC_CGO_PACKAGES=$(GO_PROJECT)/cmd/rookd $(GO_PROJECT)/cmd/rook-operator
endif
else
GO_NONSTATIC_PACKAGES=$(GO_PROJECT)
ifeq ($(ROOKD_SUPPORTED),1)
ifeq ($(GOOS),linux)
ifeq ($(PIE),1)
GO_NONSTATIC_PIE_PACKAGES+= $(GO_PROJECT)/cmd/rookd $(GO_PROJECT)/cmd/rook-operator
else
Expand Down Expand Up @@ -245,10 +209,6 @@ help:
@echo 'Options:'
@echo ''
@echo ' GOARCH The arch to build.'
@echo ' CCACHE Set to 1 to enabled ccache, 0 to disable.'
@echo ' The default is 0.'
@echo ' DEBUG Set to 1 to build without any optimizations.'
@echo ' The default is 0.'
@echo ' PIE Set to 1 to build build a position independent'
@echo ' executable. Can not be combined with LINKMODE'
@echo ' set to "static". The default is 0.'
Expand Down
2 changes: 1 addition & 1 deletion build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function start_rsync_container() {
-d \
-e OWNER=root \
-e GROUP=root \
-e MKDIRS="/volume/src/${source_repo}" \
-e MKDIRS="/volume/go/src/${source_repo}" \
-p ${rsync_port}:873 \
--entrypoint /bin/bash \
-v ${container_volume}:/volume \
Expand Down
10 changes: 2 additions & 8 deletions build/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ RUN ACBUILD_VERSION=0.4.0 && \
# - netgo: CGO_ENABLED=1, enable pure go DNS resolver
# - nocgo: CGO_ENABLED=0, defaults tags, pure Go resolver is the default
#
RUN GO_VERSION=1.7.5 && \
GO_HASH=2e4dd6c44f0693bef4e7b46cc701513d74c3cc44f2419bf519d7868b12931ac3 && \
RUN GO_VERSION=1.8 && \
GO_HASH=53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca && \
curl -fsSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o golang.tar.gz && \
echo "${GO_HASH} golang.tar.gz" | sha256sum -c - && \
tar -C /usr/local -xzf golang.tar.gz && \
Expand All @@ -102,11 +102,5 @@ RUN GO_VERSION=1.7.5 && \
\
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc go install -installsuffix race -a std

#
# build rookd package dependencies directly from source for all supported platforms.
#
COPY external /build/external/
RUN CLICOLOR_FORCE=1 /build/external/build.sh -j$(nproc) install; rm -fr /build/external

COPY entrypoint.sh rsyncd.sh /build/
ENTRYPOINT [ "/build/entrypoint.sh" ]
6 changes: 0 additions & 6 deletions build/container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ all: build
VERSION := $(shell cat version)
CONTAINER := quay.io/rook/cross-build:$(VERSION)

# turn on more verbose build
V ?= 0
ifeq ($(V),1)
BUILD_ARGS=--build-arg VERBOSE=1
endif

build: Dockerfile entrypoint.sh
docker build -t $(CONTAINER) ${BUILD_ARGS} $(CURDIR)

Expand Down
30 changes: 0 additions & 30 deletions build/container/external/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions build/container/external/build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion build/container/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.6
0.3.0
89 changes: 0 additions & 89 deletions build/makelib/cephd.mk

This file was deleted.

Loading

0 comments on commit 6e84b16

Please sign in to comment.