diff options
Diffstat (limited to 'rules')
-rw-r--r-- | rules/32.mk | 29 | ||||
-rw-r--r-- | rules/64.mk | 29 | ||||
-rw-r--r-- | rules/archive.mk | 64 | ||||
-rw-r--r-- | rules/autotools.mk | 59 | ||||
-rw-r--r-- | rules/common.mk | 90 | ||||
-rw-r--r-- | rules/ips.mk | 117 |
6 files changed, 388 insertions, 0 deletions
diff --git a/rules/32.mk b/rules/32.mk new file mode 100644 index 0000000..af1cf33 --- /dev/null +++ b/rules/32.mk @@ -0,0 +1,29 @@ +# +# 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 http://www.opensource.org/licenses/CDDL-1.0 +# 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. +# 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) 2012, Nexenta Systems, Inc. All rights reserved. +# + + +build-stamp : build-32-stamp +configure-stamp : configure-32-stamp +install-stamp : install-32-stamp + +%-32-stamp: bits = 32 diff --git a/rules/64.mk b/rules/64.mk new file mode 100644 index 0000000..0f05a1d --- /dev/null +++ b/rules/64.mk @@ -0,0 +1,29 @@ +# +# 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 http://www.opensource.org/licenses/CDDL-1.0 +# 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. +# 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) 2012, Nexenta Systems, Inc. All rights reserved. +# + + +build-stamp : build-64-stamp +configure-stamp : configure-64-stamp +install-stamp : install-64-stamp + +%-64-stamp: bits = 64 diff --git a/rules/archive.mk b/rules/archive.mk new file mode 100644 index 0000000..82d46ab --- /dev/null +++ b/rules/archive.mk @@ -0,0 +1,64 @@ +# +# 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 http://www.opensource.org/licenses/CDDL-1.0 +# 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. +# 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) 2012, Nexenta Systems, Inc. All rights reserved. +# + +# include guard +ifeq (,$(__archive_mk)) + +.SECONDEXPANSION: + +archive-validator := /usr/share/cibs/scripts/validate-archive +validate-%-stamp: download-%-stamp + if [ -n "$(checksum_$*)" ]; then \ + $(archive-validator) $* $(checksum_$*) ; \ + elif [ -n "$(checksum)" ]; then \ + $(archive-validator) $* $(checksum) ; \ + else \ + echo "** ERROR: No checksum given" >&2; false ; \ + fi + touch $@ + +validate-stamp: $$(addprefix validate-,$$(addsuffix -stamp,$$(archives) $$(archive))) + touch $@ +validate:: validate-stamp + + +archive-downloader := /usr/share/cibs/scripts/download-archive +download-%-stamp: + [ -f "$*" ] || $(archive-downloader) "$*" $(download_$*) $(download) + touch $@ + +download-stamp: $$(addprefix download-,$$(addsuffix -stamp,$$(archives) $$(archive))) + touch $@ +download:: download-stamp + + +archive-unpacker := /usr/share/cibs/scripts/unpack-archive +unpack-%-stamp: validate-%-stamp + $(archive-unpacker) $* $(sourcedir_$*) $(sourcedir) + touch $@ + +unpack-stamp: $$(addprefix unpack-,$$(addsuffix -stamp,$$(archives) $$(archive))) + +__archive_mk := included +endif + diff --git a/rules/autotools.mk b/rules/autotools.mk new file mode 100644 index 0000000..fea7d12 --- /dev/null +++ b/rules/autotools.mk @@ -0,0 +1,59 @@ +# +# 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 http://www.opensource.org/licenses/CDDL-1.0 +# 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. +# 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) 2012, Nexenta Systems, Inc. All rights reserved. +# + +# include guard +ifeq (,$(__autotools_mk)) + +include /usr/share/cibs/rules/common.mk + + +configure := $(sourcedir)/configure +configure-env = \ + CC="$(CC)" \ + CXX="$(CXX)" \ + + +configure-options = \ + --prefix="$(prefix)" \ + --libdir="$(libdir)" \ + --bindir="$(bindir)" \ + --includedir="$(includedir)" \ + +configure-%-stamp: patch-stamp unpack-stamp + [ -d "$(builddir)" ] || mkdir -p "$(builddir)" + cd "$(builddir)" && \ + env $(configure-env) \ + $(configure) $(configure-options) + touch $@ + +build-%-stamp: configure-%-stamp + cd "$(builddir)" && $(MAKE) + touch $@ + +install-%-stamp: build-%-stamp + cd "$(builddir)" && $(MAKE) install DESTDIR="$(destdir)" + touch $@ + + +__autotools_mk := included +endif diff --git a/rules/common.mk b/rules/common.mk new file mode 100644 index 0000000..ebfd992 --- /dev/null +++ b/rules/common.mk @@ -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 http://www.opensource.org/licenses/CDDL-1.0 +# 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. +# 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) 2012, Nexenta Systems, Inc. All rights reserved. +# + +# include guard: +ifeq (,$(__common_mk)) + +mach := $(shell uname -p) +mach32 := +mach64 := amd64 + +workdir := $(CURDIR)/work +sourcedir := $(workdir)/source +destdir := $(workdir)/proto +builddir.32 := $(workdir)/build/32 +builddir.64 := $(workdir)/build/64 + +CC.32 = gcc -m32 +CC.64 = gcc -m64 +CXX.32 = g++ -m32 +CXX.64 = g++ -m64 + +export PATH := \ + /usr/gcc/4.4/bin:/usr/gcc/4.3/bin:/usr/gnu/bin:/usr/sbin:/usr/bin:/sbin + +# Define LOCAL_MIRROR in environment, e. g. in ~/.bash_profile: +mirrors := $(LOCAL_MIRROR) \ + http://mirror.yandex.ru/gentoo-distfiles/distfiles \ + http://mirror.ovh.net/gentoo-distfiles/distfiles + +prefix = /usr +libdir.32 = $(prefix)/lib/$(mach32) +libdir.64 = $(prefix)/lib/$(mach64) +bindir.32 = $(prefix)/bin/$(mach32) +bindir.64 = $(prefix)/bin/$(mach64) +includedir.32 = /usr/include +includedir.64 = /usr/include + +PKG_CONFIG_PATH.32 = /usr/gnu/lib/$(mach32)/pkg-config:/usr/lib/$(mach32)/pkg-config +PKG_CONFIG_PATH.64 = /usr/gnu/lib/$(mach64)/pkg-config:/usr/lib/$(mach.64)/pkg-config +export PKG_CONFIG_PATH = PKG_CONFIG_PATH.$(bits) + +# $(bits) are target-specific and defined in 32.mk or 64.mk +bindir = $(bindir.$(bits)) +libdir = $(libdir.$(bits)) +includedir = $(includedir.$(bits)) +CC = $(CC.$(bits)) +CXX = $(CXX.$(bits)) +builddir = $(builddir.$(bits)) + + + +# Common targets for internal usage. +# Some modules (e. g. 32.mk, autotools.mk) add dependencies +# to this, for example configure with autotools +unpack-stamp patch-stamp configure-stamp build-stamp install-stamp: + touch $@ + +# Common target to use from command line +# or in component top-level Makefile: +unpack :: unpack-stamp +patch :: patch-stamp +configure :: configure-stamp +build :: build-stamp +install :: install-stamp +clean :: + rm -f *-stamp + rm -rf $(workdir) + +__common_mk := included +endif diff --git a/rules/ips.mk b/rules/ips.mk new file mode 100644 index 0000000..14a4462 --- /dev/null +++ b/rules/ips.mk @@ -0,0 +1,117 @@ +# +# 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 http://www.opensource.org/licenses/CDDL-1.0 +# 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. +# 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) 2012, Nexenta Systems, Inc. All rights reserved. +# + +# include guard: +ifeq (,$(__ips_mk)) + +include /usr/share/cibs/rules/common.mk + +manifestdir := $(workdir)/manifest +transdir := /usr/share/cibs/trans + +ifeq (,$(ips_version)) +ips_version = $(version) +endif + +# Substitutions in IPS manifest: +# XXX What about to grep all variables from component makefile? +pkg-define = \ +-Dsummary="$(summary)" \ +-Dlicense="$(license)" \ +-Dhome="$(home)" \ +-Dname="$(name)" \ +-Dversion="$(version)" \ +-Dips_version="$(ips_version)" \ +-Darchive="$(archive)" \ +-Ddownload="$(download)" \ +-Dchecksum="$(checksum)" \ + +pkg-define += \ +-DMACH="$(mach)" \ +-DMACH32="$(mach32)" \ +-DMACH64="$(mach64)" \ + + +# Where to find files: +pkg-protos = \ +-d "$(destdir)" \ +-d "$(sourcedir)" \ +-d . \ + +transformations := \ +$(transdir)/defaults \ +$(transdir)/actuators \ +$(transdir)/devel \ +$(transdir)/docs \ +$(transdir)/locale \ + + + +# Supplied canonical manifests: +manifests := $(wildcard *.p5m) + +#TODO: Expand "glob" action in manifests: +globalizator := /usr/share/cibs/scripts/globalizator +glob-manifests := $(manifests:%=$(manifestdir)/glob-%) +$(glob-manifests): $(manifestdir)/glob-% : % + [ -d "$(manifestdir)" ] || mkdir -p "$(manifestdir)" + cp $< $@ +glob-stamp: $(glob-manifests) + touch $@ + + +mogrified-manifests := $(manifests:%=$(manifestdir)/mogrified-%) +$(manifestdir)/mogrified-% : $(manifestdir)/glob-% + pkgmogrify $(pkg-define) \ + $(transformations) \ + $< | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | uniq > $@ || (rm -f $@; false) +mogrify-stamp: $(mogrified-manifests) + touch $@ + + +depend-manifests := $(manifests:%=$(manifestdir)/depend-%) +$(manifestdir)/depend-% : $(manifestdir)/mogrified-% + pkgdepend generate -m $(pkg-protos) $< > $@ || (rm -f $@; false) +depend-stamp: $(depend-manifests) + touch $@ +$(depend-manifests): install-stamp + +res_suffix := resolved +resolved-manifests := $(manifests:%=$(manifestdir)/depend-%.$(res_suffix)) +$(resolved-manifests): $(depend-manifests) + pkgdepend resolve -m -s $(res_suffix) $(depend-manifests) +resolve-stamp: $(resolved-manifests) + touch $@ + +publish-stamp: resolve-stamp + pkgsend -s $(ips-repo) publish --fmri-in-manifest \ + $(pkg-protos) \ + $(resolved-manifests) + touch $@ + +publish: publish-stamp + +__ips_mk := included +endif + |