diff --git a/.gitmodules b/.gitmodules index 6803bd9..9c5a3ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "mosquitto"] path = mosquitto url = https://github.com/eclipse/mosquitto.git +[submodule "libwebsockets"] + path = libwebsockets + url = https://github.com/dmikushin/libwebsockets.git diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4dfd5a9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,103 @@ +def build_moquitto() +{ + sh ''' + set -e + DESTDIR="$WORKSPACE/build/$arch/" + [ -d "$DESTDIR" ] && rm -rf "$DESTDIR" || true + mkdir -p "$DESTDIR" + + # build libwebsocket first + cd $WORKSPACE + [ -d libwebsockets/build/ ] && rm -rf libwebsockets/build/ || true + mkdir -p libwebsockets/build/ + cd libwebsockets/build/ + cmake -DLWS_WITH_EXTERNAL_POLL=ON -DLWS_WITH_STATIC=1 -DLWS_WITH_SHARED=0 .. + make + + # now build moquitto + cd $WORKSPACE/mosquitto + make reallyclean || true + make WITH_WEBSOCKETS=yes \ + WITH_CJSON=no \ + WITH_SHARED_LIBRARIES=no \ + WITH_SYSTEMD=no \ + WITH_DOCS=no \ + CFLAGS="-I $WORKSPACE/libwebsockets/build/include/" \ + LDFLAGS="-L $WORKSPACE/libwebsockets/build/lib" + + # install neccessary file + mkdir -p "$DESTDIR/opt/www/bin/" + mkdir -p "$DESTDIR/opt/www/config/" + cp ./src/mosquitto $DESTDIR/opt/www/bin/ + cp ./apps/mosquitto_passwd/mosquitto_passwd $DESTDIR/opt/www/bin/ + cp ./mosquitto.conf $DESTDIR/opt/www/config/ + ''' + +} + +pipeline{ + agent { node{ label'master' }} + options { + buildDiscarder(logRotator(numToKeepStr: "1")) + // Enable timestamps in build log console + timestamps() + // Maximum time to run the whole pipeline before canceling it + timeout(time: 3, unit: 'HOURS') + // Use Jenkins ANSI Color Plugin for log console + ansiColor('xterm') + // Limit build concurrency to 1 per branch + disableConcurrentBuilds() + } + stages + { + stage('Build AMD64') { + agent { + docker { + image 'xsangle/ci-tools:bionic-amd64' + reuseNode true + } + } + steps { + script{ + env.arch = "amd64" + } + build_moquitto() + } + } + stage('Build ARM64') { + agent { + docker { + image 'xsangle/ci-tools:bionic-arm64' + reuseNode true + } + } + steps { + script{ + env.arch = "arm64" + } + build_moquitto() + } + } + stage('Build ARM') { + agent { + docker { + image 'xsangle/ci-tools:bionic-arm' + reuseNode true + } + } + steps { + script{ + env.arch = "arm" + } + build_moquitto() + } + } + stage('Archive') { + steps { + script { + archiveArtifacts artifacts: 'build/', fingerprint: true + } + } + } + } +} \ No newline at end of file diff --git a/libwebsockets b/libwebsockets new file mode 160000 index 0000000..7e10336 --- /dev/null +++ b/libwebsockets @@ -0,0 +1 @@ +Subproject commit 7e1033671787300277e880d46d64a7ad27f4a09e