Signed-off-by: Daniel Nephin <dnephin@docker.com>
| ... | ... |
@@ -132,7 +132,7 @@ if \ |
| 132 | 132 |
command -v gcc &> /dev/null \ |
| 133 | 133 |
&& ! ( echo -e '#include <libdevmapper.h>\nint main() { dm_task_deferred_remove(NULL); }'| gcc -xc - -o /dev/null -ldevmapper &> /dev/null ) \
|
| 134 | 134 |
; then |
| 135 |
- DOCKER_BUILDTAGS+=' libdm_no_deferred_remove' |
|
| 135 |
+ DOCKER_BUILDTAGS+=' libdm_no_deferred_remove' |
|
| 136 | 136 |
fi |
| 137 | 137 |
|
| 138 | 138 |
# Use these flags when compiling the tests and final binary |
| ... | ... |
@@ -183,79 +183,12 @@ if [ "$(uname -s)" = 'FreeBSD' ]; then |
| 183 | 183 |
LDFLAGS="$LDFLAGS -extld clang" |
| 184 | 184 |
fi |
| 185 | 185 |
|
| 186 |
-HAVE_GO_TEST_COVER= |
|
| 187 |
-if \ |
|
| 188 |
- go help testflag | grep -- -cover > /dev/null \ |
|
| 189 |
- && go tool -n cover > /dev/null 2>&1 \ |
|
| 190 |
-; then |
|
| 191 |
- HAVE_GO_TEST_COVER=1 |
|
| 192 |
-fi |
|
| 193 |
- |
|
| 194 |
-# a helper to provide ".exe" when it's appropriate |
|
| 195 |
-binary_extension() {
|
|
| 196 |
- if [ "$(go env GOOS)" = 'windows' ]; then |
|
| 197 |
- echo -n '.exe' |
|
| 198 |
- fi |
|
| 199 |
-} |
|
| 200 |
- |
|
| 201 |
-hash_files() {
|
|
| 202 |
- while [ $# -gt 0 ]; do |
|
| 203 |
- f="$1" |
|
| 204 |
- shift |
|
| 205 |
- dir="$(dirname "$f")" |
|
| 206 |
- base="$(basename "$f")" |
|
| 207 |
- for hashAlgo in md5 sha256; do |
|
| 208 |
- if command -v "${hashAlgo}sum" &> /dev/null; then
|
|
| 209 |
- ( |
|
| 210 |
- # subshell and cd so that we get output files like: |
|
| 211 |
- # $HASH docker-$VERSION |
|
| 212 |
- # instead of: |
|
| 213 |
- # $HASH /go/src/github.com/.../$VERSION/binary/docker-$VERSION |
|
| 214 |
- cd "$dir" |
|
| 215 |
- "${hashAlgo}sum" "$base" > "$base.$hashAlgo"
|
|
| 216 |
- ) |
|
| 217 |
- fi |
|
| 218 |
- done |
|
| 219 |
- done |
|
| 220 |
-} |
|
| 221 |
- |
|
| 222 | 186 |
bundle() {
|
| 223 | 187 |
local bundle="$1"; shift |
| 224 | 188 |
echo "---> Making bundle: $(basename "$bundle") (in $DEST)" |
| 225 | 189 |
source "$SCRIPTDIR/make/$bundle" "$@" |
| 226 | 190 |
} |
| 227 | 191 |
|
| 228 |
-copy_binaries() {
|
|
| 229 |
- dir="$1" |
|
| 230 |
- # Add nested executables to bundle dir so we have complete set of |
|
| 231 |
- # them available, but only if the native OS/ARCH is the same as the |
|
| 232 |
- # OS/ARCH of the build target |
|
| 233 |
- if [ "$(go env GOOS)/$(go env GOARCH)" == "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then |
|
| 234 |
- if [ -x /usr/local/bin/docker-runc ]; then |
|
| 235 |
- echo "Copying nested executables into $dir" |
|
| 236 |
- for file in containerd containerd-shim containerd-ctr runc init proxy; do |
|
| 237 |
- cp -f `which "docker-$file"` "$dir/" |
|
| 238 |
- if [ "$2" == "hash" ]; then |
|
| 239 |
- hash_files "$dir/docker-$file" |
|
| 240 |
- fi |
|
| 241 |
- done |
|
| 242 |
- fi |
|
| 243 |
- fi |
|
| 244 |
-} |
|
| 245 |
- |
|
| 246 |
-install_binary() {
|
|
| 247 |
- file="$1" |
|
| 248 |
- target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
|
|
| 249 |
- if [ "$(go env GOOS)" == "linux" ]; then |
|
| 250 |
- echo "Installing $(basename $file) to ${target}"
|
|
| 251 |
- mkdir -p "$target" |
|
| 252 |
- cp -f -L "$file" "$target" |
|
| 253 |
- else |
|
| 254 |
- echo "Install is only supported on linux" |
|
| 255 |
- return 1 |
|
| 256 |
- fi |
|
| 257 |
-} |
|
| 258 |
- |
|
| 259 | 192 |
main() {
|
| 260 | 193 |
# We want this to fail if the bundles already exist and cannot be removed. |
| 261 | 194 |
# This is to avoid mixing bundles from different versions of the code. |
| ... | ... |
@@ -1,6 +1,13 @@ |
| 1 | 1 |
#!/usr/bin/env bash |
| 2 | 2 |
set -e |
| 3 | 3 |
|
| 4 |
+# a helper to provide ".exe" when it's appropriate |
|
| 5 |
+binary_extension() {
|
|
| 6 |
+ if [ "$(go env GOOS)" = 'windows' ]; then |
|
| 7 |
+ echo -n '.exe' |
|
| 8 |
+ fi |
|
| 9 |
+} |
|
| 10 |
+ |
|
| 4 | 11 |
GO_PACKAGE='github.com/docker/docker/cmd/dockerd' |
| 5 | 12 |
BINARY_SHORT_NAME='dockerd' |
| 6 | 13 |
BINARY_NAME="$BINARY_SHORT_NAME-$VERSION" |
| ... | ... |
@@ -9,6 +16,27 @@ BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION" |
| 9 | 9 |
|
| 10 | 10 |
source "${MAKEDIR}/.go-autogen"
|
| 11 | 11 |
|
| 12 |
+hash_files() {
|
|
| 13 |
+ while [ $# -gt 0 ]; do |
|
| 14 |
+ f="$1" |
|
| 15 |
+ shift |
|
| 16 |
+ dir="$(dirname "$f")" |
|
| 17 |
+ base="$(basename "$f")" |
|
| 18 |
+ for hashAlgo in md5 sha256; do |
|
| 19 |
+ if command -v "${hashAlgo}sum" &> /dev/null; then
|
|
| 20 |
+ ( |
|
| 21 |
+ # subshell and cd so that we get output files like: |
|
| 22 |
+ # $HASH docker-$VERSION |
|
| 23 |
+ # instead of: |
|
| 24 |
+ # $HASH /go/src/github.com/.../$VERSION/binary/docker-$VERSION |
|
| 25 |
+ cd "$dir" |
|
| 26 |
+ "${hashAlgo}sum" "$base" > "$base.$hashAlgo"
|
|
| 27 |
+ ) |
|
| 28 |
+ fi |
|
| 29 |
+ done |
|
| 30 |
+ done |
|
| 31 |
+} |
|
| 32 |
+ |
|
| 12 | 33 |
( |
| 13 | 34 |
export GOGC=${DOCKER_BUILD_GOGC:-1000}
|
| 14 | 35 |
|
| ... | ... |
@@ -1,9 +1,27 @@ |
| 1 | 1 |
#!/usr/bin/env bash |
| 2 | 2 |
set -e |
| 3 | 3 |
|
| 4 |
-[ -z "$KEEPDEST" ] && rm -rf "$DEST" |
|
| 4 |
+copy_binaries() {
|
|
| 5 |
+ local dir="$1" |
|
| 6 |
+ local hash="$2" |
|
| 7 |
+ # Add nested executables to bundle dir so we have complete set of |
|
| 8 |
+ # them available, but only if the native OS/ARCH is the same as the |
|
| 9 |
+ # OS/ARCH of the build target |
|
| 10 |
+ if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then |
|
| 11 |
+ return |
|
| 12 |
+ fi |
|
| 13 |
+ if [ ! -x /usr/local/bin/docker-runc ]; then |
|
| 14 |
+ return |
|
| 15 |
+ fi |
|
| 16 |
+ echo "Copying nested executables into $dir" |
|
| 17 |
+ for file in containerd containerd-shim containerd-ctr runc init proxy; do |
|
| 18 |
+ cp -f `which "docker-$file"` "$dir/" |
|
| 19 |
+ if [ "$hash" == "hash" ]; then |
|
| 20 |
+ hash_files "$dir/docker-$file" |
|
| 21 |
+ fi |
|
| 22 |
+ done |
|
| 23 |
+} |
|
| 5 | 24 |
|
| 6 |
-( |
|
| 7 |
- source "${MAKEDIR}/.binary"
|
|
| 8 |
- copy_binaries "$DEST" 'hash' |
|
| 9 |
-) |
|
| 25 |
+[ -z "$KEEPDEST" ] && rm -rf "$DEST" |
|
| 26 |
+source "${MAKEDIR}/.binary"
|
|
| 27 |
+copy_binaries "$DEST" 'hash' |
| ... | ... |
@@ -3,6 +3,19 @@ |
| 3 | 3 |
set -e |
| 4 | 4 |
rm -rf "$DEST" |
| 5 | 5 |
|
| 6 |
+install_binary() {
|
|
| 7 |
+ local file="$1" |
|
| 8 |
+ local target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
|
|
| 9 |
+ if [ "$(go env GOOS)" == "linux" ]; then |
|
| 10 |
+ echo "Installing $(basename $file) to ${target}"
|
|
| 11 |
+ mkdir -p "$target" |
|
| 12 |
+ cp -f -L "$file" "$target" |
|
| 13 |
+ else |
|
| 14 |
+ echo "Install is only supported on linux" |
|
| 15 |
+ return 1 |
|
| 16 |
+ fi |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 6 | 19 |
( |
| 7 | 20 |
DEST="$(dirname $DEST)/binary-daemon" |
| 8 | 21 |
source "${MAKEDIR}/.binary-setup"
|