diff --git a/utils/jenkins-build.sh b/utils/jenkins-build.sh index feb660596..0fe834c53 100755 --- a/utils/jenkins-build.sh +++ b/utils/jenkins-build.sh @@ -20,19 +20,17 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# NetSurf continuius integration build script for jenkins +# NetSurf continuous integration build script for jenkins # # This script is executed by jenkins to build netsurf itself # # Usage: jenkins-build.sh # +# TARGET is set to the frontend target to build +# label is set to the identifier of the toolchain doing the building -# TARGET must be in the environment and set correctly -if [ "x${TARGET}" = "x" ];then - echo "TARGET unset" - exit 1 -fi +################# Parameter and environment setup ##################### #identifier for this specific build IDENTIFIER="$CC-${BUILD_JS}-${BUILD_NUMBER}" @@ -40,135 +38,216 @@ IDENTIFIER="$CC-${BUILD_JS}-${BUILD_NUMBER}" # default atari architecture - bletch ATARIARCH=68020-60 -if [ "${TARGET}" = "riscos" ];then +# Ensure the combination of target and toolchain works and set build +# specific parameters too +case ${TARGET} in + "riscos") + case ${label} in + "arm-unknown-riscos") + ARTIFACT_TARGET=riscos + ;; - ARTIFACT_TARGET=riscos - PKG_SRC=netsurf - PKG_SFX=.zip + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; -elif [ "${TARGET}" = "windows" ];then + esac - ARTIFACT_TARGET=windows - PKG_SRC=netsurf-installer - PKG_SFX=.exe - -elif [ "${TARGET}" = "cocoa" ];then - - if [ "${label}" = "i686-apple-darwin10" ]; then - ARTIFACT_TARGET=Darwin - IDENTIFIER="${label}-${IDENTIFIER}" - - elif [ "${label}" = "powerpc-apple-darwin9" ]; then - ARTIFACT_TARGET=powerpc-apple-darwin9 - IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" - - else - echo "Bad cocoa label" - exit 1 - - fi - - PKG_SRC=NetSurf - PKG_SFX=.dmg - -elif [ "${TARGET}" = "amiga" ];then - - ARTIFACT_TARGET=amiga - PKG_SRC=NetSurf_Amiga/netsurf - PKG_SFX=.lha + PKG_SRC=netsurf + PKG_SFX=.zip + ;; -elif [ "${TARGET}" = "atari" ];then + "windows") + case ${label} in + "i686-w64-mingw32") + ARTIFACT_TARGET=windows + ;; - if [ "${label}" = "m68k-atari-mint" ]; then - ARTIFACT_TARGET=m68k-atari-mint - IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" - PKG_SRC=ns020 - PKG_SFX=.zip + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; - elif [ "${label}" = "m5475-atari-mint" ]; then - ARTIFACT_TARGET=m5475-atari-mint - export GCCSDK_INSTALL_ENV=/opt/netsurf/m5475-atari-mint/env - export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/m5475-atari-mint/cross/bin - ATARIARCH=v4e - IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" - PKG_SRC=nsv4e - PKG_SFX=.zip + esac - else - - echo "Bad atari label" - exit 1 - - fi - -elif [ "${TARGET}" = "gtk" ];then - - ARTIFACT_TARGET=Linux - PKG_SRC=nsgtk - PKG_SFX= - -elif [ "${TARGET}" = "framebuffer" ];then + PKG_SRC=netsurf-installer + PKG_SFX=.exe + ;; - ARTIFACT_TARGET=Linux - PKG_SRC=nsfb - PKG_SFX= + "cocoa") + case ${label} in + "i686-apple-darwin10") + ARTIFACT_TARGET=Darwin + IDENTIFIER="${label}-${IDENTIFIER}" + ;; -elif [ "${TARGET}" = "monkey" ];then + "powerpc-apple-darwin9") + ARTIFACT_TARGET=powerpc-apple-darwin9 + IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" + ;; - if [ "${label}" = "linux" ]; then - ARTIFACT_TARGET=Linux + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; - elif [ "${label}" = "i686-apple-darwin10" ]; then - ARTIFACT_TARGET=Darwin + esac - elif [ "${label}" = "powerpc-apple-darwin9" ]; then - ARTIFACT_TARGET=powerpc-apple-darwin9 + PKG_SRC=NetSurf + PKG_SFX=.dmg + ;; - elif [ "${label}" = "arm-unknown-riscos" ]; then - ARTIFACT_TARGET=riscos - export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env - export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin - elif [ "${label}" = "m68k-atari-mint" ]; then - ARTIFACT_TARGET=m68k-atari-mint - export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env - export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + "amiga") + case ${label} in + "ppc-amigaos") + ARTIFACT_TARGET=amiga + ;; - elif [ "${label}" = "m5475-atari-mint" ]; then - ATARIARCH=v4e - ARTIFACT_TARGET=m5475-atari-mint - export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env - export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; - elif [ "${label}" = "i686-w64-mingw32" ]; then - ARTIFACT_TARGET=windows - export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env - export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + esac - elif [ "${label}" = "ppc-amigaos" ]; then - ARTIFACT_TARGET=amiga - export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env - export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + PKG_SRC=NetSurf_Amiga/netsurf + PKG_SFX=.lha + ;; - else - echo "Bad monkey label" - exit 1 - fi - IDENTIFIER="${label}-${IDENTIFIER}" - PKG_SRC=nsmonkey - PKG_SFX= + "atari") + case ${label} in + "m68k-atari-mint") + ARTIFACT_TARGET=m68k-atari-mint + PKG_SRC=ns020 + PKG_SFX=.zip + ;; -else - - # unkown target - exit 1 + "m5475-atari-mint") + ARTIFACT_TARGET=m5475-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/m5475-atari-mint/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/m5475-atari-mint/cross/bin + ATARIARCH=v4e + PKG_SRC=nsv4e + PKG_SFX=.zip + ;; -fi + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; -########### Build from source ################## + esac + + IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" + ;; + + + "gtk") + case ${label} in + "linux") + ARTIFACT_TARGET=Linux + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=nsgtk + PKG_SFX= + ;; + + + "framebuffer") + case ${label} in + "linux") + ARTIFACT_TARGET=Linux + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=nsfb + PKG_SFX= + ;; + + + "monkey") + # monkey target can be built on most of the supported architectures + case ${label} in + "linux") + ARTIFACT_TARGET=Linux + ;; + + "i686-apple-darwin10") + ARTIFACT_TARGET=Darwin + ;; + + "powerpc-apple-darwin9") + ARTIFACT_TARGET=powerpc-apple-darwin9 + ;; + + "arm-unknown-riscos") + ARTIFACT_TARGET=riscos + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "m68k-atari-mint") + ARTIFACT_TARGET=m68k-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "m5475-atari-mint") + ATARIARCH=v4e + ARTIFACT_TARGET=m5475-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "i686-w64-mingw32") + ARTIFACT_TARGET=windows + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "ppc-amigaos") + ARTIFACT_TARGET=amiga + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + IDENTIFIER="${label}-${IDENTIFIER}" + PKG_SRC=nsmonkey + PKG_SFX= + ;; + + *) + # TARGET must be in the environment and set correctly + echo "Unkown TARGET \"${TARGET}\"" + exit 1 + ;; + +esac # setup environment export PREFIX=${JENKINS_HOME}/artifacts-${ARTIFACT_TARGET} @@ -176,27 +255,37 @@ export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PREFIX}/lib export PATH=${PATH}:${PREFIX}/bin -# disable ccache for clang +# configure ccache for clang if [ "${CC}" = "clang" ];then -export CCACHE_CPP2=yes -export CC="clang -Qunused-arguments" + export CCACHE_CPP2=yes + export CC="clang -Qunused-arguments" fi # convert javascript parameters if [ "${BUILD_JS}" = "json" ];then - BUILD_MOZJS=NO - BUILD_JS=YES + BUILD_MOZJS=NO + BUILD_JS=YES else BUILD_JS=NO BUILD_MOZJS=NO fi + + + +########### Build from source ################## + +# Clean first make NETSURF_USE_JS=${BUILD_JS} NETSURF_USE_MOZJS=${BUILD_MOZJS} clean # Do the Build make -k NETSURF_USE_JS=${BUILD_JS} NETSURF_USE_MOZJS=${BUILD_MOZJS} CI_BUILD=${BUILD_NUMBER} ATARIARCH=${ATARIARCH} Q= -############ Package artifact construction and deployment ################ + + + + +############ Package artifact construction ################ #destination for package artifacts DESTDIR=/srv/ci.netsurf-browser.org/html/builds/${TARGET}/ @@ -209,10 +298,14 @@ if [ ! -f "${PKG_SRC}${PKG_SFX}" ]; then exit 1 fi + + +############ Package artifact deployment ################ + # copy the file into the output - always use scp as it works local or remote scp "${PKG_SRC}${PKG_SFX}" netsurf@ci.netsurf-browser.org:${DESTDIR}/NetSurf-${IDENTIFIER}${PKG_SFX} -# remove the package file +# remove the package file rm -f "${PKG_SRC}${PKG_SFX}" # setup latest link