2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
5680N/A
5680N/A#
5680N/A# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/A#
2N/A# Rules and Macros for building opens source software that uses configure /
2N/A# GNU auto* tools to configure their build for the system they are on. This
2N/A# uses GNU Make to build the components to take advantage of the viewpath
2N/A# support and build multiple version (32/64 bit) from a shared source.
2N/A#
3817N/A# To use these rules, include $(WS_MAKE_RULES)/configure.mk in your Makefile
166N/A# and define "build", "install", and "test" targets appropriate to building
166N/A# your component.
2N/A# Ex:
2N/A#
59N/A# build: $(SOURCE_DIR)/build/$(MACH32)/.built \
59N/A# $(SOURCE_DIR)/build/$(MACH64)/.built
166N/A#
59N/A# install: $(SOURCE_DIR)/build/$(MACH32)/.installed \
59N/A# $(SOURCE_DIR)/build/$(MACH64)/.installed
2N/A#
166N/A# test: $(SOURCE_DIR)/build/$(MACH32)/.tested \
166N/A# $(SOURCE_DIR)/build/$(MACH64)/.tested
166N/A#
2N/A# Any additional pre/post configure, build, or install actions can be specified
2N/A# in your make file by setting them in on of the following macros:
2N/A# COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION
2N/A# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
2N/A# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
166N/A# COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION
2N/A#
2N/A# If component specific make targets need to be used for build or install, they
2N/A# can be specified in
2N/A# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
166N/A# COMPONENT_TEST_TARGETS
2N/A#
2N/A
5680N/ACONFIGURE_PREFIX ?= /usr
58N/A
5680N/A# If the component prefers 64-bit binaries, then ensure builds deliver 64-bit
5680N/A# binaries to the standard directories and 32-bit binaries to the non-standard
5680N/A# location. This allows simplification of package manifests and makes it
5680N/A# easier to deliver the 64-bit binaries as the default.
5680N/Aifeq ($(strip $(PREFERRED_BITS)),64)
5680N/ACONFIGURE_BINDIR.32 ?= $(CONFIGURE_PREFIX)/bin/$(MACH32)
5680N/ACONFIGURE_SBINDIR.32 ?= $(CONFIGURE_PREFIX)/sbin/$(MACH32)
5680N/ACONFIGURE_BINDIR.64 ?= $(CONFIGURE_PREFIX)/bin
5680N/ACONFIGURE_SBINDIR.64 ?= $(CONFIGURE_PREFIX)/sbin
5680N/Aelse
5680N/ACONFIGURE_BINDIR.32 ?= $(CONFIGURE_PREFIX)/bin
5680N/ACONFIGURE_SBINDIR.32 ?= $(CONFIGURE_PREFIX)/sbin
5680N/ACONFIGURE_BINDIR.64 ?= $(CONFIGURE_PREFIX)/bin/$(MACH64)
5680N/ACONFIGURE_SBINDIR.64 ?= $(CONFIGURE_PREFIX)/sbin/$(MACH64)
5680N/Aendif
5680N/A
5680N/A# Regardless of PREFERRED_BITS, 64-bit libraries should always be delivered to
5680N/A# the appropriate subdirectory by default.
5680N/ACONFIGURE_LIBDIR.32 ?= $(CONFIGURE_PREFIX)/lib
5680N/ACONFIGURE_LIBDIR.64 ?= $(CONFIGURE_PREFIX)/lib/$(MACH64)
5680N/A
5680N/ACONFIGURE_MANDIR ?= $(CONFIGURE_PREFIX)/share/man
5680N/ACONFIGURE_LOCALEDIR ?= $(CONFIGURE_PREFIX)/share/locale
58N/A# all texinfo documentation seems to go to /usr/share/info no matter what
5680N/ACONFIGURE_INFODIR ?= /usr/share/info
5680N/ACONFIGURE_INCLUDEDIR ?= /usr/include
58N/A
57N/ACONFIGURE_ENV = CONFIG_SHELL="$(CONFIG_SHELL)"
57N/A
278N/ACONFIGURE_DEFAULT_DIRS?=yes
278N/A
5123N/ACONFIGURE_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
5123N/ACONFIGURE_ENV += CC="$(CC)"
5123N/ACONFIGURE_ENV += CXX="$(CXX)"
5123N/A
5680N/A# Ensure that 64-bit versions of *-config scripts are preferred.
5680N/ACONFIGURE_ENV.64 += PATH="$(USRBIN.64):$(PATH)"
5680N/A
5680N/A# A full build must be performed if any new options are added here as not all
5680N/A# components use autoconf-based configure scripts and some have patched theirs
5680N/A# to reject "unknown" options (which may be supported by newer versions of
5680N/A# autoconf's configure).
58N/ACONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX)
278N/Aifeq ($(CONFIGURE_DEFAULT_DIRS),yes)
58N/ACONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
58N/ACONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
151N/ACONFIGURE_OPTIONS += --sbindir=$(CONFIGURE_SBINDIR.$(BITS))
5123N/ACONFIGURE_OPTIONS += --libdir=$(CONFIGURE_LIBDIR.$(BITS))
5123N/Aendif
62N/ACONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
5123N/ACONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(MACH))
5123N/ACONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(MACH).$(BITS))
58N/A
58N/ACOMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR)
2N/A
181N/A$(BUILD_DIR_32)/.configured: BITS=32
181N/A$(BUILD_DIR_64)/.configured: BITS=64
2N/A
62N/ACONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS))
814N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
814N/A# parfait creates '*.bc' files which can confuse configure's
814N/A# object/exe extension detection. which we really don't need it
814N/A# to do anyway, so we'll just tell it what they are.
814N/ACONFIGURE_ENV += ac_cv_objext=o
814N/ACONFIGURE_ENV += ac_cv_exeext=""
814N/A# this is fixed in the clang compiler but we can't use it yet
814N/ACONFIGURE_ENV += ac_cv_header_stdbool_h=yes
814N/Aendif
814N/A
5123N/A# This MUST be set in the build environment so that if pkg-config is executed
5123N/A# during the build process, the correct header files and libraries will be
5123N/A# picked up. In the Linux world, a system is generally only 32-bit or 64-bit
5123N/A# at one time so this isn't an issue that various auto* files account for (they
5123N/A# don't set PKG_CONFIG_PATH when executing pkg-config even if it was specified
5123N/A# during ./configure).
5123N/ACOMPONENT_BUILD_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
5123N/A
5680N/A# CC_FOR_BUILD and CXX_FOR_BUILD are used by autoconf to set the compiler and
5680N/A# required flags for generating native executables and is typically used for
5680N/A# host detection and other tests during the autoconf process. Explicitly
5680N/A# specifying the target bits ensures that autoconf reliably detects 32-bit and
5680N/A# 64-bit builds.
5123N/ACC_FOR_BUILD ?= "$(CC) $(CC_BITS)"
5123N/Aifneq ($(strip $(CC_FOR_BUILD)),)
5123N/ACONFIGURE_ENV += CC_FOR_BUILD=$(CC_FOR_BUILD)
5123N/Aendif
5123N/A
5680N/ACXX_FOR_BUILD ?= "$(CXX) $(CC_BITS)"
5680N/Aifneq ($(strip $(CXX_FOR_BUILD)),)
5680N/ACONFIGURE_ENV += CXX_FOR_BUILD=$(CXX_FOR_BUILD)
5680N/Aendif
5680N/A
5123N/A# Similar idea for CPP as above; there's a common macro found in lib-prefix.m4
5123N/A# for autoconf that detects a 64-bit host on Solaris by using CPP. As such, by
5123N/A# default, we need to explicitly specify the target bits to ensure that
5123N/A# autoconf reliably detects 32-bit and 64-bit builds.
5123N/ACONFIGURE_CPPFLAGS ?= $(CC_BITS)
5123N/Aifneq ($(strip $(CONFIGURE_CPPFLAGS)),)
5680N/ACONFIGURE_ENV += CPPFLAGS="$(strip $(CONFIGURE_CPPFLAGS) $(CPPFLAGS))"
5123N/Aendif
2N/A
716N/A# temporarily work around some issues
716N/ACONFIGURE_ENV += "ac_cv_func_realloc_0_nonnull=yes"
2077N/ACONFIGURE_ENV += "NM=/usr/gnu/bin/nm"
716N/ACOMPONENT_BUILD_ENV += "ac_cv_func_realloc_0_nonnull=yes"
716N/A
5879N/A# 23200148 undo this once 23169155 Move developer/gnome/gettext to Userland
5879N/ACONFIGURE_ENV += INTLTOOL_PERL="$(PERL)"
5879N/ACOMPONENT_BUILD_ENV += INTLTOOL_PERL="$(PERL)"
5879N/A
2N/A# configure the unpacked source for building 32 and 64 bit version
5123N/ACONFIGURE_SCRIPT ?= $(SOURCE_DIR)/configure
59N/A$(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep
2N/A ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
2N/A $(COMPONENT_PRE_CONFIGURE_ACTION)
16N/A (cd $(@D) ; $(ENV) $(CONFIGURE_ENV) $(CONFIG_SHELL) \
151N/A $(CONFIGURE_SCRIPT) $(CONFIGURE_OPTIONS))
2N/A $(COMPONENT_POST_CONFIGURE_ACTION)
2N/A $(TOUCH) $@
2N/A
2N/A# build the configured source
59N/A$(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured
2N/A $(COMPONENT_PRE_BUILD_ACTION)
16N/A (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
151N/A $(GMAKE) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS))
2N/A $(COMPONENT_POST_BUILD_ACTION)
814N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
1780N/A -$(PARFAIT) $(@D)
814N/Aendif
2N/A $(TOUCH) $@
2N/A
2N/A# install the built source into a prototype area
59N/A$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
2N/A $(COMPONENT_PRE_INSTALL_ACTION)
16N/A (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \
58N/A $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS))
2N/A $(COMPONENT_POST_INSTALL_ACTION)
2N/A $(TOUCH) $@
59N/A
6606N/A# Test the built source. If the output file shows up in the environment or
6606N/A# arguments, don't redirect stdout/stderr to it.
3558N/A$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
3864N/A $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
3864N/A $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
166N/A $(COMPONENT_PRE_TEST_ACTION)
3558N/A -(cd $(COMPONENT_TEST_DIR) ; \
3558N/A $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
3205N/A $(COMPONENT_TEST_CMD) \
3558N/A $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
6606N/A $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
166N/A $(COMPONENT_POST_TEST_ACTION)
3558N/A $(COMPONENT_TEST_CREATE_TRANSFORMS)
3558N/A $(COMPONENT_TEST_PERFORM_TRANSFORM)
3558N/A $(COMPONENT_TEST_COMPARE)
3558N/A $(COMPONENT_TEST_CLEANUP)
3558N/A $(TOUCH) $@
3558N/A
3558N/A$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
3558N/A $(COMPONENT_PRE_TEST_ACTION)
3558N/A (cd $(COMPONENT_TEST_DIR) ; \
3558N/A $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
3558N/A $(COMPONENT_TEST_CMD) \
3558N/A $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
3558N/A $(COMPONENT_POST_TEST_ACTION)
3558N/A $(COMPONENT_TEST_CLEANUP)
166N/A $(TOUCH) $@
166N/A
6606N/A# Test the installed packages. If the output file shows up in the environment
6606N/A# or arguments, don't redirect stdout/stderr to it.
4089N/A$(BUILD_DIR)/%/.system-tested-and-compared: $(SOURCE_DIR)/.prep
4089N/A $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
4089N/A $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
4089N/A $(COMPONENT_PRE_SYSTEM_TEST_ACTION)
4089N/A -(cd $(COMPONENT_SYSTEM_TEST_DIR) ; \
4089N/A $(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
4089N/A $(COMPONENT_SYSTEM_TEST_CMD) \
4089N/A $(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS)) \
6606N/A $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
4089N/A $(COMPONENT_POST_SYSTEM_TEST_ACTION)
4089N/A $(COMPONENT_TEST_CREATE_TRANSFORMS)
4089N/A $(COMPONENT_TEST_PERFORM_TRANSFORM)
4089N/A $(COMPONENT_TEST_COMPARE)
4089N/A $(COMPONENT_SYSTEM_TEST_CLEANUP)
4089N/A $(TOUCH) $@
4089N/A
4089N/A$(BUILD_DIR)/%/.system-tested: $(SOURCE_DIR)/.prep
4089N/A $(COMPONENT_PRE_SYSTEM_TEST_ACTION)
4089N/A (cd $(COMPONENT_SYSTEM_TEST_DIR) ; \
4089N/A $(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
4089N/A $(COMPONENT_SYSTEM_TEST_CMD) \
4089N/A $(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS))
4089N/A $(COMPONENT_POST_SYSTEM_TEST_ACTION)
4089N/A $(COMPONENT_SYSTEM_TEST_CLEANUP)
4089N/A $(TOUCH) $@
4089N/A
5680N/A# If BUILD_STYLE is set, provide a default configure target.
5680N/Aifeq ($(strip $(BUILD_STYLE)),configure)
5680N/Aconfigure: $(CONFIGURE_$(MK_BITS))
5680N/Aendif
5680N/A
814N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
1780N/Aparfait: build
814N/Aelse
814N/Aparfait:
814N/A $(MAKE) PARFAIT_BUILD=yes parfait
814N/Aendif
814N/A
3817N/AREQUIRED_PACKAGES += developer/build/autoconf
3817N/AREQUIRED_PACKAGES += developer/build/automake
3817N/AREQUIRED_PACKAGES += developer/build/gnu-make
3817N/AREQUIRED_PACKAGES += developer/build/libtool
3817N/AREQUIRED_PACKAGES += developer/build/pkg-config
3817N/AREQUIRED_PACKAGES += developer/macro/gnu-m4
3817N/AREQUIRED_PACKAGES += file/gnu-coreutils
3817N/AREQUIRED_PACKAGES += library/libtool/libltdl