Bump sessreg to 1.1.1
[unleashed-userland.git] / make-rules / build-zone.mk
blobeece54bffd8dc27ac17f875eec1f1247dc0cf92b
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
21 # Copyright (c) 2010, Oracle and/or it's affiliates. All rights reserved.
25 # Rules and Macros for creating a template build zone from the installed system
26 # and a set of build zones that are clones of the template build zone.
28 # To use these rules to create a template build zone
29 # $ gmake -f make-rules/build-zone.mk template-build-zone
31 # To use these rules to clone the template zone
32 # $ gmake -f make-rules/build-zone.mk build-zone-[1-9]
33 # or
34 # $ gmake -f make-rules/build-zone.mk \
35 # /rpool/zones/build-zone-{*}/root/etc/sysidcfg
37 # Before you create any cloned build zones, it is recommended that you create
38 # the template build zone, boot it, and make any customizations to it first.
39 # The act of booting the template zone will cause it to perform any "first boot"
40 # tasks that might othwise slow down the initial boot of a new build zone.
41 # Also, all customizations of the template zone will only propagate to the build
42 # zones when they are created.
45 ZONECFG = /usr/sbin/zonecfg
46 ZONEADM = /usr/sbin/zoneadm
47 TZ= $(shell sed -e '/^TZ=/!d' -e 's;TZ=;;' /etc/default/init)
49 ZONESCFG_DIR = /etc/zones
50 BUILD_ZONE_SPACE = /rpool/zones
52 TOUCH = /usr/bin/touch
54 SYSIDCFG = root/etc/sysidcfg
55 ZI_TAG = root/.installed
57 # the name of the template build zone
58 TMPL_ZONE_NAME = template-build-zone
61 # The template build zone will start with 'entire' installed. We include
62 # additional packages to make the build zones more closely match most
63 # components' build requirements. This makes build zone preparation quicker.
65 #TMPL_ZONE_TOOLS += developer/gcc-3
66 #TMPL_ZONE_TOOLS += developer/gnu-binutils
67 #TMPL_ZONE_TOOLS += developer/sunstudio12u1
68 TMPL_ZONE_TOOLS += archiver/gnu-tar
69 TMPL_ZONE_TOOLS += compress/p7zip
70 TMPL_ZONE_TOOLS += compress/unzip
71 TMPL_ZONE_TOOLS += developer/build/ant
72 TMPL_ZONE_TOOLS += developer/build/autoconf
73 TMPL_ZONE_TOOLS += developer/build/automake-110
74 TMPL_ZONE_TOOLS += developer/build/gnu-make
75 TMPL_ZONE_TOOLS += developer/build/libtool
76 TMPL_ZONE_TOOLS += developer/build/make
77 TMPL_ZONE_TOOLS += developer/gnome/gettext
78 TMPL_ZONE_TOOLS += developer/java/jdk
79 TMPL_ZONE_TOOLS += developer/lexer/flex
80 TMPL_ZONE_TOOLS += developer/macro/cpp
81 TMPL_ZONE_TOOLS += developer/macro/gnu-m4
82 TMPL_ZONE_TOOLS += developer/object-file
83 TMPL_ZONE_TOOLS += developer/parser/bison
84 TMPL_ZONE_TOOLS += file/gnu-coreutils
85 TMPL_ZONE_TOOLS += file/gnu-findutils
86 TMPL_ZONE_TOOLS += library/libxslt
87 TMPL_ZONE_TOOLS += library/pcre
88 TMPL_ZONE_TOOLS += text/gawk
89 TMPL_ZONE_TOOLS += text/gnu-diffutils
90 TMPL_ZONE_TOOLS += text/gnu-gettext
91 TMPL_ZONE_TOOLS += text/gnu-grep
92 TMPL_ZONE_TOOLS += text/gnu-patch
93 TMPL_ZONE_TOOLS += text/gnu-sed
94 TMPL_ZONE_TOOLS += text/groff
95 TMPL_ZONE_TOOLS += text/texinfo
97 TMPL_ZONE_PKGS = $(TMPL_ZONE_TOOLS)
99 template-build-zone: $(BUILD_ZONE_SPACE)/$(TMPL_ZONE_NAME)/$(SYSIDCFG)
100 build-zone-1: $(BUILD_ZONE_SPACE)/build-zone-1/$(SYSIDCFG)
101 build-zone-2: $(BUILD_ZONE_SPACE)/build-zone-2/$(SYSIDCFG)
102 build-zone-3: $(BUILD_ZONE_SPACE)/build-zone-3/$(SYSIDCFG)
103 build-zone-4: $(BUILD_ZONE_SPACE)/build-zone-4/$(SYSIDCFG)
104 build-zone-5: $(BUILD_ZONE_SPACE)/build-zone-5/$(SYSIDCFG)
105 build-zone-6: $(BUILD_ZONE_SPACE)/build-zone-6/$(SYSIDCFG)
106 build-zone-7: $(BUILD_ZONE_SPACE)/build-zone-7/$(SYSIDCFG)
107 build-zone-8: $(BUILD_ZONE_SPACE)/build-zone-8/$(SYSIDCFG)
108 build-zone-9: $(BUILD_ZONE_SPACE)/build-zone-9/$(SYSIDCFG)
110 # zone install options. The template zone uses "install", while the build
111 # zones "clone" the template zone.
112 ZI_OPT = clone $(TMPL_ZONE_NAME)
113 $(BUILD_ZONE_SPACE)/$(TMPL_ZONE_NAME)/$(ZI_TAG): \
114 ZI_OPT = install $(TMPL_ZONE_PKGS:%=-e %)
116 $(BUILD_ZONE_SPACE):
117 $(MKDIR) $@
119 # configure a zone
120 $(ZONECFG_DIR)/%.xml: $(BUILD_ZONE_SPACE)
121 ( echo "create -b"; \
122 echo "set zonepath=$(BUILD_ZONE_SPACE)/$(@:$(ZONECFG_DIR)/%.xml=%)"; \
123 echo "set brand=ipkg"; \
124 echo "set autoboot=false"; \
125 echo "verify"; \
126 echo "commit" ) | $(ZONECFG) -z $(@:$(ZONECFG_DIR)/%.xml=%)
128 # install a zone
129 $(BUILD_ZONE_SPACE)/%/$(ZI_TAG): $(ZONECFG_DIR)/%.xml
130 $(ZONEADM) -z $(@:$(BUILD_ZONE_SPACE)/%/$(ZI_TAG)=%) $(ZI_OPT)
132 $(BUILD_ZONE_SPACE)/%/$(SYSIDCFG): $(BUILD_ZONE_SPACE)/%/$(ZI_TAG)
133 ( echo "system_locale=C"; \
134 echo "timezone=$(TZ)"; \
135 echo "terminal=xterms"; \
136 echo "security_policy=NONE"; \
137 echo "timeserver=localhost"; \
138 echo "name_service=NONE"; \
139 echo "network_interface=none {"; \
140 echo " hostname=$(@:$(BUILD_ZONE_SPACE)/%/$(SYSIDCFG)=%)"; \
141 echo "}"; \
142 echo "nfs4_domain=dynamic"; \
143 echo "root_password=NP" ) > $@