summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-12-19 13:26:08 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2014-12-19 13:26:08 (GMT)
commit59f9a1b614f0bdfca35857ce88e3ec0e351a0f00 (patch)
treeffc304f18a0a40f6f43d3d20ac7b48a0ba64a020
parent5091cbad4a2cd9761a0ce20790e3386467a10c80 (diff)
downloadbuildsystem-59f9a1b614f0bdfca35857ce88e3ec0e351a0f00.tar.gz
buildsystem-59f9a1b614f0bdfca35857ce88e3ec0e351a0f00.tar.bz2
Fix BUILD/HOST confusion
The recent buildsystem improvements now use BUILD and HOST to set the ABI of the system doing the building and the ABI being targeted. Unfortunately we got these the wrong way round, this fixes that confusion.
-rwxr-xr-xcitools/jenkins-build.sh96
-rw-r--r--makefiles/Makefile.clang2
-rw-r--r--makefiles/Makefile.gcc4
-rw-r--r--makefiles/Makefile.norcroft2
-rw-r--r--makefiles/Makefile.tools60
-rw-r--r--makefiles/Makefile.top15
6 files changed, 101 insertions, 78 deletions
diff --git a/citools/jenkins-build.sh b/citools/jenkins-build.sh
index 1f28f63..9ce8e0e 100755
--- a/citools/jenkins-build.sh
+++ b/citools/jenkins-build.sh
@@ -1,5 +1,7 @@
#!/bin/bash
#
+# NetSurf continuous integration build script for jenkins
+#
# Copyright © 2013 Vincent Sanders <vince@netsurf-browser.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -20,8 +22,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-# NetSurf continuius integration build script for jenkins
-#
# This script may be executed by jenkins jobs that use the core buildsystem
#
# Usage: jenkins-build.sh [install|test-install|coverage|static]
@@ -32,20 +32,24 @@
# static - perform a static analysis
# coverity - perform a coverity scan
-# BUILD must be in the environment and set correctly
-if [ "x${BUILD}" = "x" ];then
- echo "BUILD unset"
+# HOST must be in the environment and set correctly
+if [ "x${HOST}" = "x" ];then
+ echo "HOST unset"
exit 1
fi
# The target for built artifacts
#
-# This does mean the artifacts of a target must all be built on the
-# same jenkins slave instance
-ARTIFACT_HOME=${JENKINS_HOME}/artifacts-${BUILD}
+# This requires the artifacts of a target must all be built on the same
+# jenkins slave instance.
+ARTIFACT_HOME=${JENKINS_HOME}/artifacts-${HOST}
+
+# Obtain the native build triplet if unset
+if [ "x${BUILD}" = "x" ];then
+ # This assumes the cc on the PATH is the native one.
+ BUILD=$(cc -dumpmachine)
+fi
-# Obtain the native target
-NATIVE_BUILD=$(cc -dumpmachine)
# target defaults
TARGET_TEST=
@@ -53,47 +57,48 @@ TARGET_INSTALL=
TARGET_COVERAGE=
TARGET_STATIC=
TARGET_COVERITY=
-TARGET_VARIANT="release"
-# change defaults based on build parameter
+# Which variant is being generated
+VARIANT="release"
+
+# change target build according to parameter
case "$1" in
"install")
- TARGET_INSTALL=${BUILD}
+ TARGET_INSTALL=${HOST}
;;
"coverage")
- TARGET_COVERAGE=${BUILD}
- TARGET_VARIANT="debug"
+ TARGET_COVERAGE=${HOST}
+ VARIANT="debug"
# need to disable ccache on coverage builds
export CCACHE=
;;
"static")
- TARGET_STATIC=${BUILD}
- TARGET_VARIANT="debug"
+ TARGET_STATIC=${HOST}
+ VARIANT="debug"
# need to disable ccache on static builds
export CCACHE=
;;
"coverity")
- TARGET_COVERITY=${BUILD}
- TARGET_VARIANT="debug"
+ TARGET_COVERITY=${HOST}
+ VARIANT="debug"
# need to disable ccache on coverity builds
export CCACHE=
;;
"test-install")
# Perfom test if being executed on native target
- TARGET_TEST=${NATIVE_BUILD}
- TARGET_INSTALL=${BUILD}
+ TARGET_TEST=${BUILD}
+ TARGET_INSTALL=${HOST}
;;
"")
# default is test only on Linux and install
# Currently most tests do not work on targets except for Linux
- # TARGET_TEST=${NATIVE_TARGET}
TARGET_TEST="x86_64-linux-gnu"
- TARGET_INSTALL=${BUILD}
+ TARGET_INSTALL=${HOST}
;;
*)
@@ -110,50 +115,59 @@ EOF
;;
esac
-# adjust settings based on build triplet
+
+# adjust tools based on build
case ${BUILD} in
amd64-unknown-openbsd*)
MAKE=gmake
- TARGET_TARGET=${BUILD}
+ ;;
+
+ x86_64-unknown-freebsd*)
+ MAKE=gmake
;;
*)
MAKE=make
- TARGET_TARGET=${BUILD}
;;
esac
+
# Ensure the artifact target directory exists
mkdir -p ${ARTIFACT_HOME}
+
# Configure all build paths relative to prefix
export PREFIX=${ARTIFACT_HOME}
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PREFIX}/lib
export PATH=${PATH}:${PREFIX}/bin
+
# execute the build steps
# clean target is always first
-${MAKE} Q= clean BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT}
+${MAKE} Q= clean HOST=${HOST} VARIANT=${VARIANT}
+
# build as per type requested
-if [ "x${BUILD}" = "x${TARGET_COVERAGE}" ]; then
+if [ "x${HOST}" = "x${TARGET_COVERAGE}" ]; then
# Coverage Build
- ${MAKE} Q= BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT} coverage
+ ${MAKE} Q= HOST=${HOST} VARIANT=${VARIANT} coverage
gcovr -x -r .. -o coverage.xml
-elif [ "x${BUILD}" = "x${TARGET_STATIC}" ]; then
+
+elif [ "x${HOST}" = "x${TARGET_STATIC}" ]; then
# static build
rm -rf clangScanBuildReports
- scan-build -o clangScanBuildReports -v --use-cc clang --use-analyzer=/usr/bin/clang ${MAKE} Q= VARIANT=${TARGET_VARIANT}
+ scan-build -o clangScanBuildReports -v --use-cc clang --use-analyzer=/usr/bin/clang ${MAKE} Q= VARIANT=${VARIANT}
# clean up after
- ${MAKE} Q= clean BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT}
+ ${MAKE} Q= clean HOST=${HOST} VARIANT=${VARIANT}
-elif [ "x${BUILD}" = "x${TARGET_COVERITY}" ]; then
+
+elif [ "x${HOST}" = "x${TARGET_COVERITY}" ]; then
# coverity build
# Check thses are set
@@ -177,7 +191,7 @@ elif [ "x${BUILD}" = "x${TARGET_COVERITY}" ]; then
# cleanup before we start
rm -rf cov-int/ coverity-scan.tar.gz coverity-scan.tar
- cov-build --dir cov-int ${MAKE} Q= BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT}
+ cov-build --dir cov-int ${MAKE} Q= HOST=${HOST} VARIANT=${VARIANT}
tar cf coverity-scan.tar cov-int
@@ -185,18 +199,22 @@ elif [ "x${BUILD}" = "x${TARGET_COVERITY}" ]; then
curl --form "project=${COVERITY_PROJECT}" --form "token=${COVERITY_TOKEN}" --form "email=${COVERITY_USER}" --form "file=@coverity-scan.tar.gz" --form "version=${COVERITY_VERSION}" --form "description=Git Head build" http://scan5.coverity.com/cgi-bin/upload.py
+
else
# Normal build
- ${MAKE} Q= BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT}
+ ${MAKE} Q= HOST=${HOST} VARIANT=${VARIANT}
+
fi
+
# run tests if appropriate
-if [ "x${BUILD}" = "x${TARGET_TEST}" ]; then
- ${MAKE} Q= BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT} test
+if [ "x${HOST}" = "x${TARGET_TEST}" ]; then
+ ${MAKE} Q= HOST=${HOST} VARIANT=${VARIANT} test
fi
+
# install the output
-if [ "x${BUILD}" = "x${TARGET_INSTALL}" ]; then
- ${MAKE} Q= BUILD=${TARGET_TARGET} VARIANT=${TARGET_VARIANT} install
+if [ "x${HOST}" = "x${TARGET_INSTALL}" ]; then
+ ${MAKE} Q= HOST=${HOST} VARIANT=${VARIANT} install
fi
diff --git a/makefiles/Makefile.clang b/makefiles/Makefile.clang
index b48c490..4006a92 100644
--- a/makefiles/Makefile.clang
+++ b/makefiles/Makefile.clang
@@ -32,7 +32,7 @@ CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))"
# Mac OS X Universal Binaries
###############################################################################
-ifeq ($(findstring darwin,$(BUILD)),darwin)
+ifeq ($(findstring darwin,$(HOST)),darwin)
ifneq ($(UNIVERSAL),)
UNIVERSAL_FLAGS := $(foreach arch,$(UNIVERSAL),-arch $(arch) )
diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc
index d469651..5f2bd4d 100644
--- a/makefiles/Makefile.gcc
+++ b/makefiles/Makefile.gcc
@@ -51,7 +51,7 @@ endif
# RISC OS module extensions
ifeq ($(COMPONENT_TYPE),riscos-module)
- ifneq ($(BUILD),arm-unknown-riscos)
+ ifneq ($(HOST),arm-unknown-riscos)
$(error Attempting to build a RISC OS module for a non-RISC OS target)
endif
@@ -64,7 +64,7 @@ endif
# Mac OS X Universal Binaries
###############################################################################
-ifeq ($(findstring darwin,$(BUILD)),darwin)
+ifeq ($(findstring darwin,$(HOST)),darwin)
ifneq ($(UNIVERSAL),)
UNIVERSAL_FLAGS := $(foreach arch,$(UNIVERSAL),-arch $(arch) )
CC_CAN_BUILD_AND_DEP := no
diff --git a/makefiles/Makefile.norcroft b/makefiles/Makefile.norcroft
index 5acb7c4..0ed798e 100644
--- a/makefiles/Makefile.norcroft
+++ b/makefiles/Makefile.norcroft
@@ -38,7 +38,7 @@ endif
# RISC OS module extensions
ifeq ($(COMPONENT_TYPE),riscos-module)
- ifneq ($(BUILD),arm-unknown-riscos)
+ ifneq ($(HOST),arm-unknown-riscos)
$(error Attempting to build a RISC OS module for a non-RISC OS target)
endif
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index 801c8c4..129d979 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -10,8 +10,8 @@
#
# Optional inputs:
#
-# HOST Platform we're building on
-# BUILD Target platform (defaults to host)
+# BUILD Platform we're building on
+# HOST Target platform (defaults to build)
# VARIANT Type of build to perform:
# release - Release build (default)
# debug - Debug build
@@ -41,6 +41,10 @@ endif
# Determine path used to load us, so we can locate other makefiles etc
###############################################################################
+# The directory in which the build system can be found
+#
+# TODO: This should be NS_BUILDSYSTEM_DIR or similar and is not connected
+# to the BUILD variable.
NSBUILD := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
NSSHARED := $(patsubst %/,%,$(dir $(NSBUILD)))
NSTESTTOOLS := $(NSSHARED)/testtools
@@ -49,33 +53,33 @@ NSTESTTOOLS := $(NSSHARED)/testtools
# Bootstrap default tooling
###############################################################################
-HOST_CC ?= cc
+BUILD_CC ?= cc
###############################################################################
# Host/build platform detection
###############################################################################
-# Autodetect build
-ifeq ($(BUILD),)
- BUILD := $(shell $(CC) -dumpmachine)
- ifeq ($(BUILD),)
- $(error "Failed to guess BUILD")
+# Autodetect host
+ifeq ($(HOST),)
+ HOST := $(shell $(CC) -dumpmachine)
+ ifeq ($(HOST),)
+ $(error "Failed to guess HOST")
endif
else
endif
-# Autodetect host if necessary
-ifeq ($(HOST),)
- HOST := $(shell $(HOST_CC) -dumpmachine)
- ifeq ($(HOST),)
- $(error "Failed to guess HOST")
+# Autodetect build if necessary
+ifeq ($(BUILD),)
+ BUILD := $(shell $(BUILD_CC) -dumpmachine)
+ ifeq ($(BUILD),)
+ $(error "Failed to guess BUILD")
endif
endif
-ifeq ($(HOST),$(BUILD))
+ifeq ($(BUILD),$(HOST))
# Native build
- ifeq ($(BUILD),i586-pc-haiku)
+ ifeq ($(HOST),i586-pc-haiku)
# Building on+for Haiku
# Default prefix
@@ -89,7 +93,7 @@ ifeq ($(HOST),$(BUILD))
PREFIX ?= $(BEOS_INSTALL_ENV)
endif
- ifeq ($(findstring openbsd,$(BUILD)),openbsd)
+ ifeq ($(findstring openbsd,$(HOST)),openbsd)
# Building on+for OpenBSD
CFLAGS := $(CFLAGS) -I$(GCCSDK_INSTALL_ENV)/include -I/usr/local/include
CXXFLAGS := $(CXXFLAGS) -I$(GCCSDK_INSTALL_ENV)/include -I/usr/local/include
@@ -105,16 +109,16 @@ else
# Improve our guess at the identity of CC
# (only if CC was not specified by the user)
ifeq ($(origin CC),default)
- CC__ := $(BUILD)-gcc
+ CC__ := $(HOST)-gcc
endif
# Search the path for the compiler
toolpath_ := $(shell /bin/which $(CC__))
ifeq ($(toolpath_),)
- toolpath_ := /opt/netsurf/$(BUILD)/cross/bin/
- CC__ := $(toolpath_)$(BUILD)-gcc
- AR__ := $(toolpath_)$(BUILD)-ar
- CXX__ := $(toolpath_)$(BUILD)-g++
+ toolpath_ := /opt/netsurf/$(HOST)/cross/bin/
+ CC__ := $(toolpath_)$(HOST)-gcc
+ AR__ := $(toolpath_)$(HOST)-ar
+ CXX__ := $(toolpath_)$(HOST)-g++
else
CC__ := $(realpath $(toolpath_))
toolpath_ := $(dir $(CC__))
@@ -132,7 +136,7 @@ else
GCCSDK_INSTALL_ENV := $(realpath $(toolpath_)../../env)
endif
- ifeq ($(BUILD),arm-unknown-riscos)
+ ifeq ($(HOST),arm-unknown-riscos)
# Cross compiling for RISC OS
CMHG ?= PATH="$(GCCSDK_INSTALL_CROSSBIN):$(PATH)" $(GCCSDK_INSTALL_CROSSBIN)/cmunge
GENHTML ?= echo
@@ -160,7 +164,7 @@ else
PREFIX ?= $(GCCSDK_INSTALL_ENV)
endif
- ifeq ($(BUILD),i686-w64-mingw32)
+ ifeq ($(HOST),i686-w64-mingw32)
# Cross compiling for Windows -- assumes mingw toolchain
GENHTML ?= echo
LCOV ?= echo
@@ -176,7 +180,7 @@ else
endif
# AmigaOS (3/4; m68k/ppc: we can treat them identically)
- ifeq ($(findstring amigaos,$(BUILD)),amigaos)
+ ifeq ($(findstring amigaos,$(HOST)),amigaos)
# Cross compiling for AmigaOS
PKGCONFIG ?= PKG_CONFIG_LIBDIR="$(PREFIX)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/share/pkgconfig" pkg-config
@@ -188,7 +192,7 @@ else
PREFIX ?= $(GCCSDK_INSTALL_ENV)
endif
- ifeq ($(BUILD),m68k-atari-mint)
+ ifeq ($(HOST),m68k-atari-mint)
# Cross compiling for FreeMiNT
ATARIARCH ?= 68020-60
@@ -213,7 +217,7 @@ else
PREFIX ?= $(GCCSDK_INSTALL_ENV)
endif
- ifeq ($(BUILD),m5475-atari-mint)
+ ifeq ($(HOST),m5475-atari-mint)
# Cross compiling for FreeMiNT (m5475)
CFLAGS := $(CFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include $(ARCHFLAGS)
CXXFLAGS := $(CXXFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include $(ARCHFLAGS)
@@ -241,7 +245,7 @@ ECHO ?= echo
GENHTML ?= genhtml
-HOST_CXX ?= c++
+BUILD_CXX ?= c++
INSTALL ?= install
@@ -335,7 +339,7 @@ else
ccvsn := $(shell $(CC) --version 2>&1)
ifeq ($(ccvsn),)
# Version string is blank
- ifeq ($(HOST),arm-unknown-riscos)
+ ifeq ($(BUILD),arm-unknown-riscos)
# For some reason we never see the output of SCL apps, so might be
# Norcroft. However it might also be a GCC linked against a buggy
# UnixLib.
diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top
index 2d09276..38922d1 100644
--- a/makefiles/Makefile.top
+++ b/makefiles/Makefile.top
@@ -15,14 +15,15 @@
#
# Optional inputs:
#
-# BUILDDIR Directory to build into (defaults to
-# build-$(HOST)-$(BUILD)-$(VARIANT)-$(COMPONENT_TYPE))
+# BUILD Build platform identifier
+# HOST Target host platform identifier, defaults to BUILD
+# BUILDDIR Directory to place built output into (defaults to
+# build-$(BUILD)-$(HOST)-$(VARIANT)-$(COMPONENT_TYPE))
+# This is not related to the BUILD platform identifier
# CC_CAN_BUILD_AND_DEP Flag whether $(CC) is capable of calculating dependency
# information at the same time as compiling sources.
# Set to "yes" if it can.
# DESTDIR Sandboxed FS root (e.g. for packaging)
-# BUILD Target platform identifier, defaults to HOST
-# HOST Host platform identifier
# REQUIRED_PKGS List of required pkg-config packages
# REQUIRED_LIBS List of required libraries to add to pkg-config
#
@@ -81,8 +82,8 @@ ifeq ($(COMPONENT_TYPE),)
endif
# Target platform must be defined by the client
-ifeq ($(BUILD),)
- $(error BUILD not defined)
+ifeq ($(HOST),)
+ $(error HOST not defined)
endif
# Build variant, too
@@ -110,7 +111,7 @@ patch-version := $(word 3,$(subst ., ,$(COMPONENT_VERSION)))
##############################################################################
# Build directory
-BUILDDIR ?= build-$(HOST)-$(BUILD)-$(VARIANT)-$(COMPONENT_TYPE)
+BUILDDIR ?= build-$(BUILD)-$(HOST)-$(VARIANT)-$(COMPONENT_TYPE)
# Build tree subdirs
COVERAGEDIR := $(BUILDDIR)/coverage