Skip to content

Commit

Permalink
Update Jenkinsfile and Makefiles to build on MacMini host. For #11 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch authored Jun 17, 2020
1 parent 44f5a0f commit 8b24179
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ if (TESTS)
add_test(zn_large_data_test bash routed.sh zn_large_data_test)
endif(TESTS)




# For packaging
if (PACKAGING)

Expand All @@ -223,19 +226,16 @@ if (PACKAGING)
set(CPACK_COMPONENT_LIB_DESCRIPTION "The C client library for Eclipse zenoh")
set(CPACK_COMPONENT_DEV_DESCRIPTION "${CPACK_COMPONENT_LIB_DESCRIPTION} - devel files")

# Sources package
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "/.git/;/build/")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-src-${PROJECT_VERSION}")
set(CPACK_GENERATOR "")

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(STATUS "Configure packaging for Linux ${TARGET_ARCH}")
# Sources package
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "/.git/;/build/")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")

set(CPACK_GENERATOR "DEB;RPM")

# DEB package
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "ADLINK zenoh team, <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${TARGET_ARCH})
Expand Down
26 changes: 21 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pipeline {
agent { label 'UbuntuVM' }
agent { label 'MacMini' }
parameters {
gitParameter name: 'TAG',
type: 'PT_TAG',
Expand Down Expand Up @@ -32,16 +32,32 @@ pipeline {
steps {
sh '''
docker images || true
make all-cross
make all all-cross
'''
}
}
stage('Deploy to to download.eclipse.org') {
stage('Deploy to download.eclipse.org') {
steps {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''
ssh [email protected] mkdir -p /home/data/httpd/download.eclipse.org/zenoh/zenoh-c/${TAG}
scp build/crossbuilds/*/*.deb* build/crossbuilds/*/*.rpm* [email protected]:/home/data/httpd/download.eclipse.org/zenoh/zenoh-c/${TAG}/
HOST="[email protected]"
DOWNLOAD_DIR="/home/data/httpd/download.eclipse.org/zenoh/zenoh-c/${TAG}"
ssh ${HOST} rm -fr ${DOWNLOAD_DIR}
ssh ${HOST} mkdir -p ${DOWNLOAD_DIR}
for PLATFORM in `ls build/crossbuilds/`; do
echo "Deploy for platform: ${PLATFORM}"
ssh ${HOST} mkdir -p ${DOWNLOAD_DIR}/${PLATFORM}
scp build/crossbuilds/${PLATFORM}/libzenohc*.* build/crossbuilds/${PLATFORM}/z_* build/crossbuilds/${PLATFORM}/zn_* ${DOWNLOAD_DIR}/${PLATFORM}/
done
echo "Deploy for platform: OSX"
ssh ${HOST} mkdir -p ${DOWNLOAD_DIR}/OSX
scp build/crossbuilds/${PLATFORM}/libzenohc*.* build/crossbuilds/${PLATFORM}/z_* build/crossbuilds/${PLATFORM}/zn_* ${DOWNLOAD_DIR}/OSX/
echo "Deploy include files"
tar czvf zenoh-c-includes.tgz include/
scp zenoh-c-includes.tgz ${DOWNLOAD_DIR}/
'''
}
}
Expand Down
13 changes: 1 addition & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# Build directory
BUILD_DIR=build

CROSS_BUILD_TARGETS=manylinux2010-x64 manylinux2010-x86 linux-armv5 linux-armv6 linux-arm64 osx-64
CROSS_BUILD_TARGETS=manylinux2010-x64 manylinux2010-x86 linux-armv5 linux-armv6 linux-arm64
CROSS_BUILD_DIR=$(BUILD_DIR)/crossbuilds
CROSS_SCRIPTS_DIR=crossbuilds

# NOTES:
# - ARM: can't use dockcross/dockcross since it uses an old GCC (4.8.3) which lacks <stdatomic.h> (even using -std=gnu11)
# - MacOS: can't use multiarch/crossbuild since it uses Clang 3.5.0 which lacks <stdatomic.h> (even using -std=gnu11)
DOCKER_CROSSBUILD_IMAGE=multiarch/crossbuild
DOCKER_OSXCROSS_IMAGE=liushuyu/osxcross
DOCKCROSS_x86_IMAGE=dockcross/manylinux2010-x86
DOCKCROSS_x64_IMAGE=dockcross/manylinux2010-x64

Expand Down Expand Up @@ -68,7 +66,6 @@ test: $(BUILD_DIR)/Makefile

DOCKER_OK := $(shell docker version 2> /dev/null)
DOCKER_CROSSBUILD_INFO := $(shell docker image inspect $(DOCKER_CROSSBUILD_IMAGE) 2> /dev/null)
DOCKER_OSXCROSS_INFO := $(shell docker image inspect $(DOCKER_OSXCROSS_IMAGE) 2> /dev/null)
DOCKCROSS_x86_INFO := $(shell docker image inspect $(DOCKCROSS_x86_IMAGE) 2> /dev/null)
DOCKCROSS_x64_INFO := $(shell docker image inspect $(DOCKCROSS_x64_IMAGE) 2> /dev/null)

Expand All @@ -79,9 +76,6 @@ endif
ifeq ($(DOCKER_CROSSBUILD_INFO),[])
docker pull $(DOCKER_CROSSBUILD_IMAGE)
endif
ifeq ($(DOCKER_OSXCROSS_INFO),[])
docker pull $(DOCKER_OSXCROSS_IMAGE)
endif
ifeq ($(DOCKCROSS_x86_INFO),[])
docker pull $(DOCKCROSS_x86_IMAGE)
endif
Expand All @@ -108,11 +102,6 @@ linux-arm64: check-docker
docker run --rm -v $(ROOT_DIR):/workdir -e CROSS_TRIPLE=aarch64-linux-gnu $(DOCKER_CROSSBUILD_IMAGE) \
make VERBOSE=1 -C$(CROSS_BUILD_DIR)/$@ all

osx-64: check-docker
docker run --rm -v $(ROOT_DIR):/workdir -w /workdir -e CC=x86_64-apple-darwin18-clang -e CXX=x86_64-apple-darwin18-clang $(DOCKER_OSXCROSS_IMAGE) bash -c "\
cmake $(CMAKE_OPT) -DCMAKE_SYSTEM_NAME=Darwin -B$(CROSS_BUILD_DIR)/$@ && \
make VERBOSE=1 -C$(CROSS_BUILD_DIR)/$@ all"

manylinux2010-x86: check-docker
docker run --rm -v $(ROOT_DIR):/workdir -w /workdir $(DOCKCROSS_x86_IMAGE) bash -c "\
cmake $(CMAKE_OPT) -DPACKAGING=ON -DTARGET_ARCH=i386 -B$(CROSS_BUILD_DIR)/$@ && \
Expand Down

0 comments on commit 8b24179

Please sign in to comment.