forked from OSInside/kiwi-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
290 lines (255 loc) · 9.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# /.../
# Copyright (c) 2006 SUSE LINUX Products GmbH. All rights reserved.
# Author: Marcus Schaefer <[email protected]>, 2006
#
# Makefile for openSUSE - KIWI Image System
# ---
arch := $(shell uname -m | grep -q ^i[3-6] && echo ix86 || uname -m)
buildroot = /
syslinux = /usr/share/syslinux
bindlib = lib
XML_CATALOG_FILES = .catalog.xml
export
#============================================
# Prefixs...
#--------------------------------------------
bin_prefix = ${buildroot}/usr/bin
init_prefix = ${buildroot}/etc/init.d
kiwi_prefix = ${buildroot}/usr/share/kiwi
tftp_prefix = ${buildroot}/srv/tftpboot
doc_prefix = ${buildroot}/usr/share/doc/packages
man_prefix = ${buildroot}/usr/share/man
emacs_prefix= ${buildroot}/usr/share/emacs
etc_prefix = ${buildroot}/etc
#============================================
# Variables...
#--------------------------------------------
KIWIBINVZ = ${buildroot}/usr/sbin
KIWIMODVZ = ${kiwi_prefix}/modules
KIWIMETAVZ = ${kiwi_prefix}/metadata
KIWILOCVZ = ${kiwi_prefix}/locale
KIWIXSLVZ = ${kiwi_prefix}/xsl
TOOLSVZ = ${bin_prefix}
LIVESTICKVZ = ${kiwi_prefix}/livestick
INITVZ = ${init_prefix}
KIWIIMAGE = ${kiwi_prefix}/image
KIWIEDITING = ${kiwi_prefix}/editing
KIWIEMACS = ${emacs_prefix}/site-lisp
KIWIREPO = ${kiwi_prefix}/repo
KIWITESTS = ${kiwi_prefix}/tests
TFTPKIWI = ${tftp_prefix}/KIWI
TFTPBOOT = ${tftp_prefix}/
TFTPBOOTBOOT= ${tftp_prefix}/boot
TFTPBOOTCONF= ${tftp_prefix}/pxelinux.cfg
TFTPUPLOAD = ${tftp_prefix}/upload
TFTPIMAGE = ${tftp_prefix}/image
PACKDOCVZ = ${doc_prefix}/kiwi
MANVZ = ${man_prefix}/man1
BASHCOMPL = ${etc_prefix}/bash_completion.d
ifdef KIWIVERBTEST
TESTVERBOSE = --verbose
endif
ifdef KIWINONETWORKTEST
NONETWORKTEST = env KIWI_NO_NET=1
endif
ifdef KIWINOFSTEST
KIWINOFSTEST = env KIWI_NO_FS=1
endif
all: modules/KIWISchema.rng
@echo Compiling...
#============================================
# build tools
#--------------------------------------------
${MAKE} -C tools all
${MAKE} -C locale all
#============================================
# install .revision file
#--------------------------------------------
test -f ./.revision || ./.version > .revision
install: uninstall
@echo Installing...
#============================================
# Install base directories
#--------------------------------------------
install -d -m 755 ${KIWIBINVZ} ${KIWIMODVZ} ${KIWIIMAGE} ${KIWIXSLVZ}
install -d -m 755 ${TFTPKIWI} ${TFTPBOOT} ${TFTPBOOTCONF} ${TFTPIMAGE}
install -d -m 755 ${TFTPBOOTBOOT} ${KIWILOCVZ} ${KIWIKEYVZ} ${KIWIMETAVZ}
install -d -m 755 ${TFTPUPLOAD} ${KIWIREPO}
install -d -m 755 ${PACKDOCVZ} ${MANVZ} ${BASHCOMPL}
install -d -m 755 ${TOOLSVZ} ${INITVZ} ${LIVESTICKVZ}
install -d -m 755 ${KIWIEDITING} ${KIWIEMACS} ${KIWITESTS}
#============================================
# install XML editor support
#--------------------------------------------
# for Emacs
install -m 644 ./editing/suse-start-kiwi-mode.el ${KIWIEMACS}
install -m 644 ./editing/suse-start-kiwi-xmllocator.xml ${KIWIEDITING}
# for Bash
install -m 644 ./editing/kiwi.sh ${BASHCOMPL}
#============================================
# install .revision file
#--------------------------------------------
install -m 644 ./.revision ${kiwi_prefix}
#============================================
# kiwi documentation and examples
#--------------------------------------------
cp -a doc/examples/ ${PACKDOCVZ}
cp -a doc/schema/ ${PACKDOCVZ}
cp -a doc/pdf/ ${PACKDOCVZ}
cp -a doc/html/ ${PACKDOCVZ}
cp -a doc/COPYING ${PACKDOCVZ}
rm -rf ${PACKDOCVZ}/html/images
mkdir -p ${PACKDOCVZ}/html/images
cp -a doc/docbook/images/*.png ${PACKDOCVZ}/html/images
cp -a doc/docbook/images/callouts ${PACKDOCVZ}/html/images
rm -f ${PACKDOCVZ}/schema/Makefile
#============================================
# kiwi manual pages
#--------------------------------------------
for i in $(shell ls -1 ./doc/man/*.1);do \
install -m 644 $$i ${MANVZ} ;\
done
#============================================
# Install kiwi tests
#--------------------------------------------
cp -r ./tests/unit ${KIWITESTS}
install -m 755 ./tests/writeTester ${KIWITESTS}
#============================================
# Install kiwi tools
#--------------------------------------------
${MAKE} -C tools TOOLSVZ=${TOOLSVZ} INITVZ=${INITVZ} install
#============================================
# Install KIWI base and modules
#--------------------------------------------
install -m 755 ./kiwi.pl ${KIWIBINVZ}/kiwi
install -m 644 ./xsl/* ${KIWIXSLVZ}
for i in $(shell find modules -type f | grep -v -E '\.test');do \
install -m 644 $$i ${KIWIMODVZ} ;\
done
#============================================
# Install KIWI metadata files
#--------------------------------------------
tar -C metadata -czf ${KIWIMETAVZ}/KIWIAnalyse.tgz d3
for i in $(shell find metadata -type f | grep -v -E 'd3');do \
install -m 644 $$i ${KIWIMETAVZ} ;\
done
#============================================
# install NLS support (translations)...
#--------------------------------------------
${MAKE} -C locale KIWILOCVZ=${KIWILOCVZ} install
#============================================
# Install TFTP netboot structure and loader
#--------------------------------------------
test -f ${syslinux}/pxelinux.0 && \
install -m 755 ${syslinux}/pxelinux.0 ${TFTPBOOT}/pxelinux.0|| /bin/true
test -f ${syslinux}/mboot.c32 && \
install -m 755 ${syslinux}/mboot.c32 ${TFTPBOOT}/mboot.c32 || /bin/true
install -m 644 pxeboot/README ${TFTPBOOT}
#install -m 755 pxeboot/pxelinux.0.config ${TFTPBOOTCONF}/default
#============================================
# Install boot image descriptions
#--------------------------------------------
cp -a system/boot/${arch}/* ${KIWIIMAGE} &>/dev/null || true
cp system/boot/${arch}/.md5 ${KIWIIMAGE}
(cd ${KIWIIMAGE} && ./.md5)
(cd ${KIWIIMAGE} && \
find -type f | grep -v -E ".git|.test|.md5" |\
xargs chmod u-w &>/dev/null || true)
rm -f ${KIWIIMAGE}/.md5
#============================================
# Update link to boot code
#--------------------------------------------
for i in `find ${KIWIIMAGE} -name include`;do \
pushd `dirname $$i`;\
rm -f include;\
ln -s /usr/share/kiwi/modules/KIWILinuxRC.sh include;\
popd;\
done
#============================================
# Update link to boot locale
#--------------------------------------------
for i in `find ${KIWIIMAGE} -name locale`;do \
pushd `dirname $$i`;\
rm -f locale;\
ln -s /usr/share/kiwi/locale locale;\
popd;\
done
#============================================
# Install system image template descriptions
#--------------------------------------------
cp -a template/${arch}/* ${KIWIIMAGE} &>/dev/null || true
rm -f ${KIWIIMAGE}/README
#============================================
# Install kiwi repo
#--------------------------------------------
cp -a system/repo/${arch}/* ${KIWIREPO}
modules/KIWISchema.rng: modules/KIWISchema.rnc
@echo Building Schema...
#============================================
# Convert RNC -> RNG...
#--------------------------------------------
@echo "*** Converting KIWI RNC -> RNG..."
trang -I rnc -O rng modules/KIWISchema.rnc modules/KIWISchema.rng
valid: modules/KIWISchema.rng
#============================================
# Validate all XML descriptions...
#--------------------------------------------
for i in $(shell find doc template/$(arch)/ system/boot/$(arch)/ -name config.xml);do \
test -f xsl/master.xsl && \
xsltproc -o $$i.new xsl/master.xsl $$i && mv $$i.new $$i;\
echo $$i;\
KIWI_IGNORE_OLD_MOUNTS=1 ./kiwi --check-config $$i || exit 1;\
done
test:
#============================================
# Run unit tests...
#--------------------------------------------
tests/unit/cleanup.sh
if test ! -d tests/.timestamps; then \
mkdir tests/.timestamps; \
fi
for i in $(shell find -name "*.t" | cut -d/ -f4);do \
touch tests/.timestamps/$$i's';\
done
cd tests/unit && \
${NONETWORKTEST} ${KIWINOFSTEST} perl /usr/bin/prove \
${TESTVERBOSE} ${TRAVISENV} .
critic:
#============================================
# Run critic tests...
#--------------------------------------------
.git-hooks/pre-commit --test-all
%.t:
#============================================
# Run specific unit test
#--------------------------------------------
tests/unit/cleanup.sh
if test ! -d tests/.timestamps; then \
mkdir tests/.timestamps; \
fi
touch tests/.timestamps/$@s
cd tests/unit && \
${NONETWORKTEST} ${KIWINOFSTEST} perl /usr/bin/prove \
${TESTVERBOSE} $@
clean:
@echo Cleanup...
(cd system/boot && find -type f | grep -v .svn | xargs chmod u+w)
(find -name .checksum.md5 | xargs rm -f)
(find -name .dice | xargs rm -rf)
(find -name .vagrant | xargs rm -rf)
${MAKE} -C tools clean
${MAKE} -C locale clean
rm -f tools/burner/Makefile
rm -f tools/burner/imagewriter
rm -f metadata/KIWIAnalyse.tgz
rm -f .revision
rm -f .kiwirc
uninstall:
@echo Uninstalling...
rm -rf ${buildroot}/usr/share/kiwi
rm -rf ${buildroot}/usr/share/doc/packages/kiwi
rm -f ${buildroot}/usr/sbin/kiwi
rm -f ${buildroot}/usr/share/emacs/site-lisp/suse-start-kiwi-mode.el
rm -f ${buildroot}/etc/bash_completion.d/kiwi.sh
build: clean
./.doit -p --local