summaryrefslogtreecommitdiffstats
path: root/perl-install/Makefile
blob: 96028e3af599365305908cf0df65e0864566fde0 (plain)
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
VERSION     = 2.2.10-BOOT                                                                             
SUDO        = sudo
SO_FILES    = c/blib/arch/auto/c/c.so                                                                 
PMS         = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm pci_probing/*.pm commands install2 g_auto_install
PMS	   += $(patsubst %, standalone/%,diskdrake XFdrake rpmdrake mousedrake printerdrake)
REP4PMS     = /usr/bin/perl-install
ROOTDEST    = /export
DEST        = $(ROOTDEST)/Mandrake/mdkinst
STAGE2      = $(ROOTDEST)/Mandrake/base/mdkinst_stage2
BASE        = $(ROOTDEST)/Mandrake/base
DESTREP4PMS = $(DEST)$(REP4PMS)
PERL        = perl
LOCALFILES  = $(patsubst %, ../tools/%,e2fsck.shared ddcprobe/ddcxinfos pnp_serial/pnp_serial)
LOCALFILES2 = extract_archive
DIRS        = c Newt po pci_probing resize_fat
EXCLUDE     = $(LOCALFILES) boot.img keymaps consolefonts install
CFLAGS	    = -Wall
override CFLAGS  += -pipe

.PHONY: all $(DIRS) install clean stage2 full_stage2 verify_c 

all: TAGS $(DIRS)

TAGS: $(PMS)
	etags -o - $^ | ./perl2etags > $@

clean:
	for i in $(DIRS); do $(MAKE) -C $$i clean; done
	rm -rf auto
	find . -name "*~" -o -name ".#*" -o -name "TAGS" -o -name "*.old" | xargs rm -f

tar-drakxtools: clean
	$(MAKE) -C ../tools clean
	cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af tools/ddcprobe tools/pnp_serial drakxtools	
	cd ../drakxtools ; rm -rf install* ForMakefile.pm pkgs.pm ftp.pm t.pm standalone/CVS ; mv Makefile.drakxtools Makefile ; mv -f standalone/* .
	cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile MonitorsDB Newt c ddcprobe pnp_serial po pci_probing resize_fat diskdrake diskdrake.rc XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake *.pm)
	cd .. ; rm -rf drakxtools

$(DIRS):
	install -d auto
	$(MAKE) -C $@

test_pms: verify_c
	./perl2fcalls -excludec -excluderesize_fat::c_rewritten install2
	for i in install2 install_steps_*.pm; do perl -cw -I. $$i; done

verify_c:
	./verify_c $(PMS)

install_pms: $(DIRS)
	for i in `perl -ne 's/sub (\w+?)_? {.*/$$1/ and print' commands.pm`; do ln -sf commands $(DEST)/usr/bin/$$i; done

	install -d $(DESTREP4PMS)
	for i in $(PMS); do \
		dest=$(DESTREP4PMS)/`dirname $$i`; \
		install -d $$dest; \
		perl -ne 'print' $$i > $(DESTREP4PMS)/$$i; \
		perl -pe 's/#-.*//; $$_ = "\n" if (/^=head/ .. /^=cut/) || /use (diagnostics)/' $$i > $(DESTREP4PMS)/$$i; \
	done
#		perl -pe 's/#-.*//; $$_ = "\n" if (/^=head/ .. /^=cut/) || /use (diagnostics|vars|strict)/' $$i > $(DESTREP4PMS)/$$i; \

	cp *.rc $(DESTREP4PMS)
	install -d $(DESTREP4PMS)/po
	cp -f po/*.po* $(DESTREP4PMS)/po ||:
	chmod a+x $(DESTREP4PMS)/install2
	chmod a+x $(DESTREP4PMS)/commands
	chmod a+x $(DESTREP4PMS)/standalone/*
	chmod a+x $(DESTREP4PMS)/g_auto_install

get_needed_files: $(DIRS)
#	export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2 < /dev/null
	cp -f list /tmp/list
	find auto -follow -name "*.so" >> /tmp/list

	for i in $(LOCALFILES) `cat /tmp/list` ; do \
		ldd $$i 2>/dev/null | grep -v "not a dynamic" | sed -e 's/.*=> //' -e 's/ .*//' | uniq | sort >> /tmp/list; \
	done

	install -d $(DEST)/etc
	install -d $(DEST)/lib
	install -d $(DEST)/bin
	install -d $(DEST)/usr/bin
	install -d $(DEST)/usr/lib
	install -d $(DEST)/usr/share
	install -d $(DEST)/usr/share/gtk
	install -d $(DEST)/usr/share/xmodmap
	install -d $(DEST)/usr/X11R6/lib/X11
	install -d $(ROOTDEST)/Mandrake/base
	install -s $(LOCALFILES) $(DEST)/usr/bin
	cp -f $(LOCALFILES2) $(DEST)/usr/bin

	for i in `cat /tmp/list`; do \
		if (echo $$i | grep -q "lib/[^/]*\.so"); then \
		  install -s $$i $(DEST)/lib; \
		else \
		  d=$$i; \
	          (echo $$d | grep -q "^[^/]") && d="$(REP4PMS)/$$d"; \
		  d=`echo $(DEST)/$$d | sed 's/\/usr\/local\//\/usr\//'`; \
		  install -d `dirname $$d` && \
		  if (echo $$i | grep -q "\.pm"); then \
		     perl -pe '$$_ =~ /^__END__/ and exit(0);' $$i > $$d; \
		  elif (echo $$i | grep -q "\.so"); then \
			  install -s $$i $$d; \
		  else \
		  	  cp -f $$i $$d; \
		  fi; \
		fi; \
	done
	mv -f $(DEST)/lib/libimlib-png.so $(DEST)/usr/lib

	mv -f $(DEST)/bin/* $(DEST)/sbin/* $(DEST)/usr/bin
	cd $(DEST)/usr/bin ; mv insmod insmod_
	rmdir $(DEST)/bin $(DEST)/sbin

	perl -ane 'symlink "$$F[1]", "$(DEST)/usr/bin/$$F[0]"' aliases

	tar xfy locales.tar.bz2 -C $(DEST)
#	DEST=$(DEST) perl -I. -MForMakefile -e 'locale()'
#	DEST=$(DEST) perl -I. -MForMakefile -e 'xmodmap()'

	cp -a keymaps $(DEST)/usr/share
	cp -a consolefonts $(DEST)/usr/share
	cp template.in/*.in modparm.lst $(DEST)/usr/share
	cp MonitorsDB $(DEST)/usr/X11R6/lib/X11
	cp logo-mandrake.xpm $(DEST)/usr/share
	cp -a themes $(DEST)/usr/share/gtk
	cp compss compssUsers compssList $(ROOTDEST)/Mandrake/base

	if [ -f "../modules/modules.cz2" ]; then \
		cp -f ../modules/modules.cz2 $(DEST)/lib/; \
		cp -f ../modules/modules.cz2.pl $(DEST)/lib/; \
	else \
		cp -f ../modules/modules.cpio.bz2 $(DEST)/lib/; \
		install -d $(DEST)/lib/modules; \
		cp -f ../modules/pristine/* $(DEST)/lib/modules ||: ; \
	fi

#	echo -e "#!/bin/sh\n\nexec '/usr/bin/sh'" > $(DEST)/usr/bin/runinstall2
#	chmod a+x $(DEST)/usr/bin/runinstall2

	tar xyC $(DEST) -f ../install/install1_pcmcia.tar.bz2 ./etc/pcmcia

full_stage2:
	sudo rm -rf $(DEST)
	mkdir -p $(DEST)
	$(MAKE) get_needed_files 
	$(MAKE) stage2

stage2:
	$(MAKE) install_pms
	$(ROOTDEST)/misc/make_mdkinst_stage2 $(DEST) $(ROOTDEST)/Mandrake/base/mdkinst_stage2