Norm Jacobs
2010-05-07 9c75c0f62b0f2d120258704abba7a2af151ad805
include gmake example
16 files added
871 ■■■■■ changed files
Makefile 45 ●●●●● patch | view | raw | blame | history
README 40 ●●●●● patch | view | raw | blame | history
components/Makefile 63 ●●●●● patch | view | raw | blame | history
components/file/Makefile 49 ●●●●● patch | view | raw | blame | history
components/file/config.patch 8 ●●●●● patch | view | raw | blame | history
components/lcms/Makefile 52 ●●●●● patch | view | raw | blame | history
components/pycups/Makefile 48 ●●●●● patch | view | raw | blame | history
make-rules/configure.mk 90 ●●●●● patch | view | raw | blame | history
make-rules/ips.mk 69 ●●●●● patch | view | raw | blame | history
make-rules/prep.mk 60 ●●●●● patch | view | raw | blame | history
make-rules/setup.py.mk 43 ●●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 75 ●●●●● patch | view | raw | blame | history
tools/unpack.py 144 ●●●●● patch | view | raw | blame | history
transforms/archive-libraries-drop 2 ●●●●● patch | view | raw | blame | history
transforms/defaults 81 ●●●●● patch | view | raw | blame | history
transforms/libtool-drop 2 ●●●●● patch | view | raw | blame | history
Makefile
New file
@@ -0,0 +1,45 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
include make-rules/shared-macros.mk
SUBDIRS += components
download:    TARGET = download
prep:        TARGET = prep
build:        TARGET = build
install:    TARGET = install
publish:    TARGET = publish
validate:    TARGET = validate
clean:        TARGET = clean
clobber:    TARGET = clobber
setup:        TARGET = setup
.DEFAULT:    publish
download setup prep build install publish validate clean clobber: $(SUBDIRS)
$(SUBDIRS):    FORCE
    cd $@ ; echo "$(TARGET) \c" ; pwd ; $(GMAKE) $(TARGET)
FORCE:
README
New file
@@ -0,0 +1,40 @@
This workspace contains examples of building open source software components using three methodologies.  In the spec-files directory, the pkgbuild is use to build the components from a RPM spec file based build.  In the components directory, a make(1) based build is used.
spec-files
    spec based build
components
    GNU make based build(s)
make-rules
    Shared rules to include in component specific makefiles (instructions)
    make-rules/configure.mk
        shared rules for components using GNU auto* tools to build
    make-rules/ips.mk
        shared rules for packaging under IPS
    make-rules/prep.mk
        shared rules for downloading, unpacking, and patching component
        source.
    make-rules/setup.py.mk
        shared rules for components using python setup.py to build
    make-rules/shared-macros.mk
        common macros that apply to building many things.
tools
    shared tools for building components
transforms
    shared pkgmogrify(1) transformations to apply to packages as they are
    being built and published
To build uing the GNU make based build you can
    $ WS_TOP=$(pwd) ; cd components ; gmake -j 4 publish
This will construct a files based repository for publishing, create a log directory, build the components (4 at a time) and publish them to the repo.  Logs of each component build will go in the logs directory
components/Makefile
New file
@@ -0,0 +1,63 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
include ../make-rules/shared-macros.mk
COMPONENT_DIRS +=    lcms
COMPONENT_DIRS +=    file
COMPONENT_DIRS +=    pycups
download:    TARGET = download
prep:        TARGET = prep
build:        TARGET = build
install:    TARGET = install
publish:    TARGET = publish
validate:    TARGET = validate
clean:        TARGET = clean
clobber:    TARGET = clobber
.DEFAULT:    publish
.PARALLEL:    $(COMPONENT_DIRS)
download prep build install publish validate: setup $(COMPONENT_DIRS)
clean clobber:    $(COMPONENT_DIRS)
ifeq ($(findstring file://, $(PKG_REPO)),file://)
    $(RM) -r $(PKG_REPO:file://%=%) $(WS_LOGS)
endif
setup:    $(WS_LOGS) repo
$(WS_LOGS):
    $(MKDIR) $@
repo:
    $(PKGSEND) -s $(PKG_REPO) create-repository \
        --set-property publisher.prefix=$(PUBLISHER)
$(COMPONENT_DIRS):    FORCE
    @cd $@ ; echo "$(TARGET) \c" ; pwd ; \
     $(GMAKE) $(TARGET) >$(WS_LOGS)/$(TARGET):$@.log 2>&1
FORCE:
components/file/Makefile
New file
@@ -0,0 +1,49 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
include ../../make-rules/shared-macros.mk
PATH=/usr/bin:/usr/gnu/bin
COMPONENT_NAME=        file
COMPONENT_VERSION=    5.0.4
COMPONENT_DESCRIPTION=    "command and library to determine file type"
COMPONENT_SRC=        $(COMPONENT_NAME)-5.04
COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH=    56ddf7135471aa656334ed8fefe1112bcccc2cc3
COMPONENT_ARCHIVE_URL=    ftp://ftp.fu-berlin.de/unix/tools/file/$(COMPONENT_ARCHIVE)
include ../../make-rules/prep.mk
include ../../make-rules/configure.mk
include ../../make-rules/ips.mk
PKGMOGRIFY_TRANSFORMS +=    $(WS_TOP)/transforms/archive-libraries-drop
PKGMOGRIFY_TRANSFORMS +=    $(WS_TOP)/transforms/libtool-drop
# common targets
build:        $(COMPONENT_SRC)/build-32/.built \
        $(COMPONENT_SRC)/build-64/.built
install:    $(COMPONENT_SRC)/build-32/.installed \
        $(COMPONENT_SRC)/build-64/.installed
BUILD_PKG_DEPENDENCIES =    $(BUILD_TOOLS)
components/file/config.patch
New file
@@ -0,0 +1,8 @@
--- file-5.04/configure.ac.orig    2010-05-07 10:58:59.053717431 -0500
+++ file-5.04/configure.ac    2010-05-07 10:59:15.618253998 -0500
@@ -1,4 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
+dnl NORM WAS HERE
 AC_INIT(file, 5.04, christos@astron.com)
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(config.h)
components/lcms/Makefile
New file
@@ -0,0 +1,52 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
include ../../make-rules/shared-macros.mk
PATH=/usr/bin:/usr/gnu/bin
COMPONENT_NAME=        lcms
COMPONENT_VERSION=    1.19
COMPONENT_DESCRIPTION=    "Little Color Management System"
COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH=    4f192cfd36d8b819e6885571401f949220609005
COMPONENT_ARCHIVE_URL=    http://www.littlecms.com/$(COMPONENT_ARCHIVE)
include ../../make-rules/prep.mk
include ../../make-rules/configure.mk
include ../../make-rules/ips.mk
PKGMOGRIFY_TRANSFORMS +=    $(WS_TOP)/transforms/archive-libraries-drop
PKGMOGRIFY_TRANSFORMS +=    $(WS_TOP)/transforms/libtool-drop
# additional preparation after unpacking and patching
COMPONENT_PREP_ACTION=    $(RM) $(@D)/include/icc34.h
# common targets
build:        $(COMPONENT_SRC)/build-32/.built \
        $(COMPONENT_SRC)/build-64/.built
install:    $(COMPONENT_SRC)/build-32/.installed \
        $(COMPONENT_SRC)/build-64/.installed
BUILD_PKG_DEPENDENCIES =    $(BUILD_TOOLS)
components/pycups/Makefile
New file
@@ -0,0 +1,48 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
include ../../make-rules/shared-macros.mk
PATH=/usr/bin:/usr/gnu/bin
COMPONENT_NAME=        pycups
COMPONENT_VERSION=    1.9.46
COMPONENT_DESCRIPTION=    "Python language bindings for CUPS"
COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.bz2
COMPONENT_ARCHIVE_HASH=    3d58a0f7b4a1b6a2880baf9ef5e14eae461d0982
COMPONENT_ARCHIVE_URL=    http://cyberelk.net/tim/data/pycups/$(COMPONENT_ARCHIVE)
include ../../make-rules/prep.mk
include ../../make-rules/setup.py.mk
include ../../make-rules/ips.mk
PYTHON_ENV +=    CFLAGS=-DVERSION=\\\"$(COMPONENT_VERSION)\\\"
# common targets
build:        $(COMPONENT_SRC)/build-32/.built \
        $(COMPONENT_SRC)/build-64/.built
install:    $(COMPONENT_SRC)/build-32/.installed \
        $(COMPONENT_SRC)/build-64/.installed
BUILD_PKG_DEPENDENCIES =    $(BUILD_TOOLS)
make-rules/configure.mk
New file
@@ -0,0 +1,90 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
#
# Rules and Macros for building opens source software that uses configure /
# GNU auto* tools to configure their build for the system they are on.  This
# uses GNU Make to build the components to take advantage of the viewpath
# support and build multiple version (32/64 bit) from a shared source.
#
# To use these rules, include ../make-rules/configure.mk in your Makefile
# and define "build", "install" targets appropriate to building your component.
# Ex:
#
#     build:        $(COMPONENT_SRC)/build-32/.built \
#             $(COMPONENT_SRC)/build-64/.built
#
#    install:    $(COMPONENT_SRC)/build-32/.installed \
#             $(COMPONENT_SRC)/build-64/.installed
#
# Any additional pre/post configure, build, or install actions can be specified
# in your make file by setting them in on of the following macros:
#    COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION
#    COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
#    COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
#
# If component specific make targets need to be used for build or install, they
# can be specified in
#    COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
#
CONFIG_SHELL =    /bin/bash
CONFIGURE_OPTIONS += --prefix=/usr
CONFIGURE_OPTIONS += CC="$(CC.$(BITS))"
CONFIGURE_OPTIONS += CXX="$(CCC.$(BITS))"
CONFIGURE_OPTIONS.32 += --bindir=/usr/bin
CONFIGURE_OPTIONS.32 += --libdir=/usr/lib
CONFIGURE_OPTIONS.64 = --bindir=/usr/bin/$(MACH64)
CONFIGURE_OPTIONS.64 += --libdir=/usr/lib/$(MACH64)
$(COMPONENT_SRC)/build-32/.configured:    BITS=32
$(COMPONENT_SRC)/build-64/.configured:    BITS=64
CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
# set the default target for installation of the component
COMPONENT_INSTALL_TARGETS =    install
# configure the unpacked source for building 32 and 64 bit version
$(COMPONENT_SRC)/build-%/.configured:    $(COMPONENT_SRC)/.prep
    ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
    $(COMPONENT_PRE_CONFIGURE_ACTION)
    (cd $(@D) ; env - $(CONFIGURE_ENV) $(CONFIG_SHELL) \
        ../configure $(CONFIGURE_OPTIONS) $(CONFIGURE_OPTIONS.$(BITS)))
    $(COMPONENT_POST_CONFIGURE_ACTION)
    $(TOUCH) $@
# build the configured source
$(COMPONENT_SRC)/build-%/.built:    $(COMPONENT_SRC)/build-%/.configured
    $(COMPONENT_PRE_BUILD_ACTION)
    (cd $(@D) ; $(GMAKE) $(COMPONENT_BUILD_TARGETS))
    $(COMPONENT_POST_BUILD_ACTION)
    $(TOUCH) $@
# install the built source into a prototype area
$(COMPONENT_SRC)/build-%/.installed:    $(COMPONENT_SRC)/build-%/.built
    $(COMPONENT_PRE_INSTALL_ACTION)
    (cd $(@D) ; $(GMAKE) DESTDIR=$(PROTO_DIR)  $(COMPONENT_INSTALL_TARGETS))
    $(COMPONENT_POST_INSTALL_ACTION)
    $(TOUCH) $@
make-rules/ips.mk
New file
@@ -0,0 +1,69 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
#
# Rules and Macros for generating an IPS package manifest and publishing an
# IPS package to a pkg depot.
#
# To use these rules, include ../make-rules/ips.mk in your Makefile
# and define an "install" target appropriate to building your component.
# Ex:
#
#    install:    $(COMPONENT_SRC)/build-32/.installed \
#             $(COMPONENT_SRC)/build-64/.installed
#
# This set of rules makes the "publish" target the default target for make(1)
#
PKGSEND =    /usr/bin/pkgsend
PKGMOGRIFY =    /usr/bin/pkgmogrify
PKGDEPEND =    /usr/bin/pkgdepend
# Add some default transforms that should apply to everyone
PKGMOGRIFY_TRANSFORMS +=    $(WS_TOP)/transforms/defaults
PKGMOGRIFY_TRANSFORMS +=    $(WS_TOP)/transforms/actuators
.DEFAULT:    publish
publish:    $(COMPONENT_SRC)/.published
$(COMPONENT_SRC)/manifest:    install
    pkgsend generate $(PROTO_DIR) >$@
$(COMPONENT_SRC)/manifest.mog:    $(COMPONENT_SRC)/manifest
    echo "set name=pkg.fmri value=pkg:/$(PUBLISHER)/$(COMPONENT_NAME)@$(COMPONENT_VERSION),$(BUILD_VERSION)" >$@
    echo "set name=pkg.description value=\"$(COMPONENT_DESCRIPTION)\"" >>$@
    echo "set name=pkg.name value=\"$(COMPONENT_DESCRIPTION)\"" >>$@
    echo "set name=org.opensolaris.consolidation value=$(CONSOLIDATION)" >>$@
    pkgmogrify $(PKGMOGRIFY_MACROS:%=-D %) $(PKGMOGRIFY_TRANSFORMS) $< >>$@
$(COMPONENT_SRC)/manifest.fdeps:    $(COMPONENT_SRC)/manifest.mog
    pkgdepend generate -m $< $(PROTO_DIR) >$@
$(COMPONENT_SRC)/manifest.fdeps.res:    $(COMPONENT_SRC)/manifest.fdeps
    pkgdepend resolve -m $<
$(COMPONENT_SRC)/.published:    $(COMPONENT_SRC)/manifest.fdeps.res
    pkgsend -s $(PKG_REPO) publish --fmri-in-manifest \
        -d $(PROTO_DIR) $<
    $(TOUCH) $@
make-rules/prep.mk
New file
@@ -0,0 +1,60 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
UNPACK =    $(TOOLS)/unpack.py
ARCHIVES += $(COMPONENT_ARCHIVE)
CLEAN_PATHS += $(COMPONENT_SRC)
CLOBBER_PATHS += $(COMPONENT_ARCHIVE)
#PATCHES =    $(shell ls *.patch) #find . -type f -name '*.patch'
PATCHES =    $(shell find . -type f -name '*.patch' | \
             sed -e 's;^\./;;' | sort)
STAMPS =    $(PATCHES:%=$(COMPONENT_SRC)/.patched.%)
$(COMPONENT_SRC)/.patched.%:    %
    $(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
    $(TOUCH) $@
$(COMPONENT_ARCHIVE):
    wget $(COMPONENT_ARCHIVE_URL)
$(COMPONENT_SRC)/.unpacked:    $(COMPONENT_ARCHIVE)
    $(UNPACK) $(UNPACK_ARGS) $(COMPONENT_ARCHIVE)
    $(TOUCH) $@
$(COMPONENT_SRC)/.patched:    $(COMPONENT_SRC)/.unpacked $(STAMPS)
    $(TOUCH) $@
$(COMPONENT_SRC)/.prep:    $(COMPONENT_SRC)/.patched
    $(COMPONENT_PREP_ACTION)
    $(TOUCH) $@
prep::    $(COMPONENT_SRC)/.prep
clean::
    $(RM) -r $(CLEAN_PATHS)
clobber::    clean
    $(RM) -r $(CLOBBER_PATHS)
make-rules/setup.py.mk
New file
@@ -0,0 +1,43 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
$(COMPONENT_SRC)/build-32/.built:    BITS=32
$(COMPONENT_SRC)/build-64/.built:    BITS=64
$(COMPONENT_SRC)/build-32/.installed:    BITS=32
$(COMPONENT_SRC)/build-64/.installed:    BITS=64
# build the configured source
$(COMPONENT_SRC)/build-%/.built:    $(COMPONENT_SRC)/.prep
    $(RM) -r $(@D) ; $(MKDIR) $(@D)
    $(COMPONENT_PRE_BUILD_ACTION)
    (cd $(COMPONENT_SRC) ; env - $(PYTHON_ENV) $(PYTHON.$(BITS)) ./setup.py build --build-temp $(@D:$(COMPONENT_SRC)/%=%))
    $(COMPONENT_POST_BUILD_ACTION)
    $(TOUCH) $@
# install the built source into a prototype area
$(COMPONENT_SRC)/build-%/.installed:    $(COMPONENT_SRC)/build-%/.built
    $(COMPONENT_PRE_INSTALL_ACTION)
    (cd $(COMPONENT_SRC) ; env - $(PYTHON_ENV) $(PYTHON.$(BITS)) ./setup.py install --root $(PROTO_DIR))
    $(COMPONENT_POST_INSTALL_ACTION)
    $(TOUCH) $@
make-rules/shared-macros.mk
New file
@@ -0,0 +1,75 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
CONSOLIDATION =    userland
PUBLISHER =    $(CONSOLIDATION)-build
BUILD_VERSION =    5.11-0.140
COMPILER =        studio
PYTHON_VERSION =    2.6
TOOLS =        $(WS_TOP)/tools
WS_LOGS =    $(WS_TOP)/logs
MAKE_RULES =    $(WS_TOP)/components/make-rules
PKG_REPO =    file://$(WS_TOP)/repo
PROTO_DIR =    $(shell pwd)/$(COMPONENT_SRC)/installed-prototype
MACH64 =    $(shell isainfo -k)
SPRO_ROOT =    /opt/sunstudio12.1
GCC_ROOT =    /usr/gnu
CC.studio.32 =    $(SPRO_ROOT)/bin/cc -m32
CCC.studio.32 =    $(SPRO_ROOT)/bin/CC -m32
CC.studio.64 =    $(SPRO_ROOT)/bin/cc -m64
CCC.studio.64 =    $(SPRO_ROOT)/bin/CC -m64
CC.gcc.32 =    $(GCC_ROOT)/bin/cc -m32
CCC.gcc.32 =    $(GCC_ROOT)/bin/CC -m32
CC.gcc.64 =    $(GCC_ROOT)/bin/cc -m64
CCC.gcc.64 =    $(GCC_ROOT)/bin/CC -m64
CC =        $(CC.$(COMPILER).$(BITS))
CCC =        $(CCC.$(COMPILER).$(BITS))
PYTHON.2.4.32 =    /usr/bin/python2.4
PYTHON.2.4.64 =    /usr/bin/amd64/python2.4
PYTHON.2.6.32 =    /usr/bin/python2.6
PYTHON.2.6.64 =    /usr/bin/amd64/python2.6
PYTHON.32 =    $(PYTHON.$(PYTHON_VERSION).$(BITS))
PYTHON.64 =    $(PYTHON.$(PYTHON_VERSION).$(BITS))
GMAKE =        /usr/gnu/bin/make
GPATCH =    /usr/gnu/bin/patch
GPATCH_FLAGS =    -p1 -b
PKGSEND =    /usr/bin/pkgsend
TOUCH =        /usr/bin/touch
MKDIR =        /bin/mkdir -p
RM =        /bin/rm -f
tools/unpack.py
New file
@@ -0,0 +1,144 @@
#!/usr/bin/python2.6
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
#
# unpack.py - an archive unpack utility
#
#  A simple program to uncompress and unpack source archive files into a target
#  directory and fix permissions if requested.
#
import os
import sys
def uncompress_unpack_commands(filename, verbose=False):
    import re
    uncompress = "/bin/cat"
    if (re.search("(\.bz2|\.tbz|\.tbz2)$", filename) != None):
        uncompress = "/usr/bin/bzip2 -dc"
    elif (re.search("(\.gz|\.tgz)$", filename) != None):
        uncompress = "/usr/bin/gzip -dc"
    elif (re.search("(\.Z)$", filename) != None):
        uncompress = "/usr/bin/uncompress -c"
    elif (re.search("(\.7z)$", filename) != None):
        uncompress = "/usr/bin/7z --s"
    elif (re.search("(\.zip)$", filename) != None):
        uncompress = "/usr/bin/unzip -qo"
    unpack = " | gtar -xf -"
    if (re.search("(\.zip)$", filename) != None):
        unpack = ""
    elif (re.search("(\.jar)$", filename) != None):
        unpack = " | jar xf -"
    if (verbose == True):
        print "command: %s %s %s" % (uncompress, filename, unpack)
    return uncompress, unpack
#
# recurse down a directory tree opening permissions so that others may access
# files in the tree.
#
def fixup_permissions(dir, verbose):
    for entry in os.listdir(dir):
        import stat
        path = "%s/%s" % (dir, entry)
        st = os.lstat(path)
        mode = stat.S_IMODE(st.st_mode)
        mode |= (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
        if stat.S_ISDIR(st.st_mode):
            mode |= (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
        if (stat.S_IMODE(st.st_mode) != mode):
            if (verbose == True):
                print "Changing %s from %4.4o to %4.4o" % (path,
                        stat.S_IMODE(st.st_mode), mode)
            os.chmod(path, mode)
        if stat.S_ISDIR(st.st_mode):
            fixup_permissions(path, verbose)
def usage():
    print "Usage: %s [-v|--verbose] [-f|--fix-permissions] [-r|--relocate-to (dir)] (file)" % (sys.argv[0].split('/')[-1])
    sys.exit(1)
def main():
    import getopt
    import sys
    import tempfile
    verbose = False
    permissions = None
    relocate_to = None
    try:
        opts, args = getopt.getopt(sys.argv[1:], "fr:v",
            ["fix-permissions", "relocate-to=", "verbose"])
    except getopt.GetoptError, err:
        print str(err)
        usage()
    for opt, arg in opts:
        if opt in [ "-v", "--verbose" ]:
            verbose = True
        elif opt in [ "-f", "--fix-permissions" ]:
            permissions = True
        elif opt in [ "-r", "--relocate-to" ]:
            relocate_to = arg
        else:
            assert False, "unknown option"
    filename = ((args[0] == '/') and "%s" or "../%s") % args[0]
    uncompress, unpack = uncompress_unpack_commands(filename)
    tempdir = tempfile.mkdtemp(dir='.')
    # extract the archive contents
    if (verbose == True):
        print "cd %s ; %s %s%s" % (tempdir, uncompress, filename,
                        unpack)
    os.system("cd %s ; %s %s%s" % (tempdir, uncompress, filename, unpack))
    # open up the permissions on what we extracted
    if permissions:
        fixup_permissions(tempdir, verbose)
    if (relocate_to == None):
        # move everything in the tempdir here
        for entry in os.listdir(tempdir):
            path= "%s/%s" % (tempdir, entry)
            os.renames(path, entry)
    else:
        # rename the tempdir and open it's permissions
        os.renames(tempdir, relocate_to)
        os.chmod(relocate_to, 0755)
if __name__ == "__main__":
    main()
transforms/archive-libraries-drop
New file
@@ -0,0 +1,2 @@
# stuff we drop from the proto area - not shipped
<transform file path=.+/lib/.+\.a -> drop>
transforms/defaults
New file
@@ -0,0 +1,81 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#
# This isn't really a transform, but it's a valid default.
#
#set name=org.opensolaris.consolidation value=osnet
#
# For kernel/drv, set .conf files to mode 0644.  Assume all other
# files there are drivers, and give them mode 0755 and reboot-needed.
#
# The (?<!r) construct in the reboot-needed transform is a negative
# lookbehind assertion: it says "only match this regex if the
# previously matched text does NOT match regex r."  So it will match
# all files in the various kernel trees, except for .conf files.
#
<transform file path=.*kernel/drv/.+\.conf -> default mode 0644>
<transform file path=.*kernel/drv/.+ -> default mode 0755>
<transform file path=.*kernel/.+(?<!\.conf)$ -> default reboot-needed true>
#
# shared objects should generally have mode 0755
#
<transform file path=.*lib/.*\.so.* -> default mode 0755>
#
# Catch some of the collections of largely read-only files
#
<transform file path=usr/lib/help/.+ -> default mode 0444>
<transform file path=usr/share/doc/ksh/.+ -> default mode 0644>
<transform file path=usr/share/ipfilter/.+ -> default mode 0644>
<transform file path=usr/share/lib/ccs/.+ -> default mode 0644>
<transform file path=usr/share/lib/java/.+ -> default mode 0644>
<transform file path=usr/share/lib/locale/com/sun/dhcpmgr/.+\.properties -> default mode 0644>
<transform file path=usr/share/lib/locale/com/sun/dhcpmgr/.+ -> default mode 0444>
<transform file path=usr/share/lib/locale/com/sun/.+ -> default mode 0644>
<transform file path=usr/share/lib/mailx/.+ -> default mode 0644>
<transform file path=usr/share/lib/nterm/.+ -> default mode 0644>
<transform file path=usr/share/lib/pub/.+ -> default mode 0644>
<transform file path=usr/share/lib/sgml/.+ -> default mode 0644>
<transform file path=usr/share/lib/slp/.+ -> default mode 0644>
<transform file path=usr/share/lib/tabset/.+ -> default mode 0644>
<transform file path=usr/share/lib/t.+ -> default mode 0644>
<transform file path=usr/share/lib/unittab/.+ -> default mode 0644>
<transform file path=usr/share/lib/zoneinfo/.+ -> default mode 0644>
<transform file path=usr/share/src/grub/.+ -> default mode 0644>
<transform file path=usr/share/.+ -> default mode 0444>
#
# For what's left, go with root:bin 0644, +x for directories
#
#
<transform file dir -> default owner root>
<transform file dir -> default group bin>
<transform file -> default mode 0644>
<transform dir -> default mode 0755>
transforms/libtool-drop
New file
@@ -0,0 +1,2 @@
# stuff we drop from the proto area - not shipped
<transform file path=.+/lib/.+\.la -> drop>