perl: Add %guestfs_introspection hash with introspection information.
[libguestfs.git] / images / Makefile.am
1 # libguestfs test images
2 # Copyright (C) 2009-2010 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 include $(top_srcdir)/subdir-rules.mk
19
20 # Old RHEL 5 autoconf doesn't have builddir.
21 builddir ?= $(top_builddir)/images
22
23 EXTRA_DIST = \
24         helloworld.tar \
25         helloworld.tar.gz \
26         helloworld.tar.xz \
27         mbr-ext2-empty.img.gz \
28         empty known-1 known-2 known-3 known-4 known-5 \
29         bin-i586-dynamic \
30         bin-sparc-dynamic \
31         bin-win32.exe \
32         bin-win64.exe \
33         bin-x86_64-dynamic \
34         lib-i586.so \
35         lib-sparc.so \
36         lib-win32.dll \
37         lib-win64.dll \
38         lib-x86_64.so \
39         test-grep.txt \
40         guest-aux/make-debian-img.sh \
41         guest-aux/debian-packages \
42         guest-aux/make-fedora-img.sh \
43         guest-aux/fedora-name.db.txt \
44         guest-aux/fedora-name.db \
45         guest-aux/make-ubuntu-img.sh \
46         guest-aux/make-windows-img.sh \
47         guest-aux/windows-software \
48         guest-aux/windows-software.reg \
49         guest-aux/windows-system \
50         guest-aux/windows-system.reg \
51         guest-aux/minimal-hive
52
53 noinst_DATA = test.iso
54
55 # This is 'check_DATA' because we don't need it until 'make check'
56 # time and we need the tools we have built in order to make it.
57 check_DATA = debian.img fedora.img ubuntu.img windows.img
58
59 CLEANFILES = \
60         test.iso test.sqsh \
61         100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
62         initrd $(check_DATA)
63
64 images_files_src = \
65         $(srcdir)/helloworld.tar \
66         $(srcdir)/helloworld.tar.gz \
67         $(srcdir)/helloworld.tar.xz \
68         $(srcdir)/empty \
69         $(srcdir)/known-1 \
70         $(srcdir)/known-2 \
71         $(srcdir)/known-3 \
72         $(srcdir)/known-4 \
73         $(srcdir)/known-5 \
74         $(srcdir)/bin-i586-dynamic \
75         $(srcdir)/bin-sparc-dynamic \
76         $(srcdir)/bin-win32.exe \
77         $(srcdir)/bin-win64.exe \
78         $(srcdir)/bin-x86_64-dynamic \
79         $(srcdir)/lib-i586.so \
80         $(srcdir)/lib-sparc.so \
81         $(srcdir)/lib-win32.dll \
82         $(srcdir)/lib-win64.dll \
83         $(srcdir)/lib-x86_64.so \
84         $(srcdir)/test-grep.txt
85
86 images_files_build = \
87         $(builddir)/100kallzeroes \
88         $(builddir)/100kallnewlines \
89         $(builddir)/100kallspaces \
90         $(builddir)/100krandom \
91         $(builddir)/10klines \
92         $(builddir)/abssymlink \
93         $(builddir)/hello.b64 \
94         $(builddir)/initrd \
95         $(builddir)/initrd-x86_64.img \
96         $(builddir)/initrd-x86_64.img.gz \
97         $(builddir)/test-grep.txt.gz
98
99 images_files = $(images_files_src) $(images_files_build)
100
101 test.iso: $(images_files)
102         rm -f $@ $@-t
103         mkdir -p directory
104         $(MKISOFS) -J -r -graft-points \
105           -o $@-t \
106           $(images_files) /directory=directory
107         rmdir directory
108         mv $@-t $@
109
110 $(builddir)/100kallzeroes:
111         rm -f $@ $@-t
112         dd if=/dev/zero of=$@-t bs=1024 count=100
113         mv $@-t $@
114
115 $(builddir)/100kallnewlines: $(builddir)/100kallzeroes
116         rm -f $@ $@-t
117         tr '\0' '\n' < $< > $@-t
118         mv $@-t $@
119
120 $(builddir)/100kallspaces: $(builddir)/100kallzeroes
121         rm -f $@ $@-t
122         tr '\0' ' ' < $< > $@-t
123         mv $@-t $@
124
125 $(builddir)/100krandom:
126         rm -f $@ $@-t
127         dd if=/dev/urandom of=$@-t bs=1024 count=100
128         mv $@-t $@
129
130 $(builddir)/10klines:
131         rm -f $@ $@-t
132         i=0; \
133         while [ $$i -lt 10000 ]; do \
134           echo "$${i}abcdefghijklmnopqrstuvwxyz"; \
135           i=$$(($$i+1)); \
136         done > $@-t
137         mv $@-t $@
138
139 $(builddir)/abssymlink:
140         ln -sf /10klines $@
141
142 $(builddir)/hello.b64:
143         echo "hello" | base64 > $@
144
145 $(builddir)/initrd: empty known-1 known-2 known-3 known-4 known-5
146         rm -f $@ $@-t
147         for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t
148         mv $@-t $@
149
150 # Create a dummy initrd with a single file called 'bin/nash' which
151 # is used to test the Sys::Guestfs::Lib::file_architecture function.
152 $(builddir)/initrd-x86_64.img: bin-x86_64-dynamic
153         rm -rf bin $@ $@-t
154         mkdir bin
155         cp $< bin/nash
156         echo bin/nash | cpio -o -H newc > $@-t
157         mv $@-t $@
158         rm -rf bin $@-t
159
160 $(builddir)/initrd-x86_64.img.gz: initrd-x86_64.img
161         rm -f $@ $@-t
162         gzip --best -c $< > $@-t
163         mv $@-t $@
164
165 $(builddir)/test-grep.txt.gz: test-grep.txt
166         rm -f $@ $@-t
167         gzip --best -c $< > $@-t
168         mv $@-t $@
169
170 # Make a (dummy) Fedora image.
171 fedora.img: guest-aux/make-fedora-img.sh guest-aux/fedora-name.db
172         LIBGUESTFS_PATH=../appliance \
173         LD_LIBRARY_PATH=../src/.libs \
174         TMPDIR=$(top_builddir) \
175         bash $<
176
177 guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
178         $(DB_LOAD) $@ < $<
179
180 # Make a (dummy) Debian image.
181 debian.img: guest-aux/make-debian-img.sh
182         LIBGUESTFS_PATH=$(top_builddir)/appliance \
183         LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
184         TMPDIR=$(top_builddir) \
185         bash $<
186
187 # Make a (dummy) Ubuntu image.
188 ubuntu.img: guest-aux/make-ubuntu-img.sh
189         LIBGUESTFS_PATH=$(top_builddir)/appliance \
190         LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
191         TMPDIR=$(top_builddir) \
192         bash $<
193
194 # Make a (dummy) Windows image.
195 windows.img: guest-aux/make-windows-img.sh \
196              guest-aux/windows-software guest-aux/windows-system
197         LIBGUESTFS_PATH=$(top_builddir)/appliance \
198         LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
199         TMPDIR=$(top_builddir) \
200         bash $<
201
202 # Since users might not have the tools needed to create this, we
203 # also distribute these files.
204 guest-aux/windows-software: guest-aux/windows-software.reg
205         rm -f $@ $@-t
206         cp guest-aux/minimal-hive $@-t
207         hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SOFTWARE' $<
208         mv $@-t $@
209
210 guest-aux/windows-system: guest-aux/windows-system.reg
211         rm -f $@ $@-t
212         cp guest-aux/minimal-hive $@-t
213         hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $<
214         mv $@-t $@