1: # The LearningOnline Network with CAPA
2:
3: # Scott Harrison
4: # $Id: Makefile,v 1.82 2002/04/22 17:41:20 harris41 Exp $
5:
6: DISTPROBE=`perl ./distprobe`
7: DIST=$(DISTPROBE)
8: CATEGORY="development"
9: SOURCE=../..
10: TARGET=""
11: NORESTORECONF="0"
12: HOSTNAME=""
13: LAUNCH=| perl
14: OUTSTREAM=>
15: SAVE=program.pl.$(TIMESTAMP)
16: LAUNCHSAVE=$(OUTSTREAM) $(SAVE)
17: METAMTARGET=""
18: MTARGET=""
19: VERSION=0.1
20:
21: help:
22: @echo "*** You need to specify a valid target ***"
23: @echo "NOTE: You can specify options to your Makefile target."
24: @echo "(option) DIST can be redhat7.1, debian, redhat6.2, or default"
25: @echo "(option) CATEGORY can be runtime or development"
26: @echo "(option) SOURCE is an absolute or relative directory path"
27: @echo "(option) TARGET is an absolute or relative directory path"
28: @echo "build: compile the CVS source tree"
29: @echo "install: install from a compiled CVS source tree to a "
30: @echo " specified TARGET destination on the filesystem"
31: @echo "test: test different parts of the LON-CAPA system (TEST_*)"
32: @echo "TEST_lpml_scripts: make sure that the system can process "
33: @echo " the Linux Packaging Markup Language"
34: @echo "TEST_system_dependencies: make sure that all needed system "
35: @echo " components are active and present "
36: @echo " on the server such as perl modules"
37: @echo " and the MySQL database"
38: @echo "TEST_web_layer: mimic a login and various system actions on "
39: @echo " a LON-CAPA system"
40: @echo "HTML: generate an HTML-formatted description of the LON-CAPA"
41: @echo " CVS files"
42: @echo "documentation_tree: compiles a documentation tree from the "
43: @echo " CVS:doc directory"
44: @echo "status: compare the TARGET filesystem with a compiled CVS "
45: @echo " source directory"
46: @echo "statuspost: post the results of "make status" to "
47: @echo " TARGET/home/httpd/html/lon-status/filestatus.html"
48: @echo "rpmstatus: compare the rpms on a system to defined lists "
49: @echo " CVS:doc/otherfiles/cd_rpms and "
50: @echo " CVS:doc/otherfiles/rpm_list.txt"
51: @echo "rpmstatuspost: post the results of "make rpmstatus" to "
52: @echo " TARGET/home/httpd/html/lon-status/rpmstatus.html"
53: @echo "RPM: build LON-CAPA-base RPM from CVS repository"
54: @echo "setup_RPM: build LON-CAPA-setup RPM from CVS repository"
55: @echo " handy for CD-ROM generation"
56:
57: test: TEST_lpml_scripts TEST_system_dependencies TEST_web_layer
58: @echo "ALL SYSTEM DEPENDENCY TESTS SUCCESSFUL"
59:
60: TEST_system_dependencies:
61: @echo "TESTING SYSTEM DEPENDENCIES"
62: cd system_dependencies; make
63:
64: TEST_lpml_scripts:
65: @echo "TESTING LPML INSTALLATION CODE"
66: cd ../test; perl filecomparetest.pl
67:
68: TEST_web_layer:
69: @echo "TESTING WEB LAYER"
70: cd weblayer_test; make
71:
72: TEST_hosts_tab:
73: @echo "Testing hosts.tab"
74: @if (test -h ../hosts.tab); then \
75: echo "there is a defined link; assume okay"; \
76: else echo "**** ERROR **** hosts.tab not defined!" && \
77: echo -n "You need to do one of the following within your " && \
78: echo "CVS repository" && \
79: echo " 1) cd ../; ln -s production_hosts.tab hosts.tab" && \
80: echo " 2) cd ../; ln -s development_hosts.tab hosts.tab" && \
81: echo "or 3) cd ../; ln -s rawhide_hosts.tab hosts.tab" && \
82: echo "(you most likely want option #1, production_hosts.tab)" && \
83: exit 1; \
84: fi
85:
86: NET_hosts_tab:
87: make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
88: MTARGET="hosts_tab" HOSTNAME="$(HOSTNAME)" lpmladm
89:
90: hosts_tab: TEST_hosts_tab
91: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
92: perl xfml_parse.pl $(SOURCE)/doc/loncapafiles/valid_hosts.xfml | \
93: perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
94: "$(TARGET)" > Makefile.install
95: make -f Makefile.install directories
96: make -f Makefile.install files
97: @echo "If hosts.tab has changed, restart httpd and loncontrol:"
98: @echo " /etc/rc.d/init.d/httpd restart"
99: @echo " /etc/rc.d/init.d/loncontrol restart"
100:
101: lpmladm:
102: @if (test $(METAMTARGET) = "TRANSPORT"); then \
103: echo "Transporting to $(HOSTNAME)"; \
104: sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
105: SOURCE="$(SOURCE)" \
106: TARGET="lpmladm.$(TIMESTAMP)" \
107: NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
108: cd lpmladm.$(TIMESTAMP); \
109: sudo tar czvf ../tarball$(TIMESTAMP).tar.gz .; \
110: cd ..; scp tarball$(TIMESTAMP).tar.gz \
111: lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
112: ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
113: ssh lpmladm@$(HOSTNAME) sudo tar -x -z -v -C / \
114: -p --same-owner -f \
115: /tarball$(TIMESTAMP).tar.gz; \
116: ssh lpmladm@$(HOSTNAME) sudo rm -f \
117: /tarball$(TIMESTAMP).tar.gz; \
118: elif (test $(METAMTARGET) = "LAUNCH"); then \
119: echo "Launching process on $(HOSTNAME)"; \
120: LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
121: make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
122: TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
123: LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
124: scp $(SAVE) lpmladm@$(HOSTNAME):~/$(SAVE); \
125: ssh lpmladm@$(HOSTNAME) sudo perl $(SAVE); \
126: ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
127: else \
128: echo "**** ERROR **** Incorrect METAMTARGET"; \
129: fi
130:
131: HTML:
132: install -d HTML
133: cp $(SOURCE)/doc/loncapafiles/*.gif HTML
134: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
135: perl lpml_parse.pl html development default "$(SOURCE)" '$(TARGET)' \
136: > HTML/index.html
137:
138: status:
139: install -d HTML
140: cp $(SOURCE)/doc/loncapafiles/*.gif HTML
141: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
142: perl lpml_parse.pl html $(CATEGORY) $(DIST) "$(SOURCE)" "($TARGET)" | \
143: perl lpml_html_posteval.pl > \
144: HTML/filestatus.html
145:
146: statuspost: status
147: cp $(SOURCE)/doc/loncapafiles/*.gif \
148: $(TARGET)/home/httpd/html/lon-status
149: cp HTML/filestatus.html \
150: $(TARGET)/home/httpd/html/lon-status/filestatus.html
151:
152: rpmstatus:
153: install -d RPMSTATUS
154: rpm -qa --queryformat \
155: '%{NAME}\t%{VERSION}\t%{RELEASE}\t%{BUILDTIME}\n' | sort > \
156: RPMSTATUS/current.tmp
157: cat $(SOURCE)/doc/otherfiles/cd_rpms.txt > RPMSTATUS/standard.tmp
158: cat $(SOURCE)/doc/otherfiles/rpm_list.txt > RPMSTATUS/expected.tmp
159: perl rpmparse.pl RPMSTATUS/standard.tmp RPMSTATUS/current.tmp \
160: RPMSTATUS/expected.tmp > RPMSTATUS/rpmstatus.html
161:
162: rpmstatuspost: rpmstatus
163: cp RPMSTATUS/rpmstatus.html /home/httpd/html/lon-status/rpmstatus.html
164:
165: configinstall: Makefile.configinstall
166: make -f Makefile.configinstall SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
167: configfiles
168: if (test "0" = $(NORESTORECONF)); then \
169: perl loncaparestoreconfigurations suffix .lpmlnew; fi
170:
171: Makefile.configinstall: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
172: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
173: perl lpml_parse.pl configinstall $(CATEGORY) $(DIST) "$(SOURCE)" \
174: "$(TARGET)" > Makefile.configinstall
175:
176: warningnote:
177: @if (test -s WARNINGS); then \
178: W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
179: E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
180: N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
181: echo "---> $$W WARNINGS ENCOUNTERED! "; \
182: echo "---> $$E ERRORS ENCOUNTERED! "; \
183: echo "---> $$N NOTES ENCOUNTERED! "; \
184: echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
185: echo "!!!! Please read the WARNINGS file !!!!"; \
186: echo "!!!! to make sure everything is !!!!"; \
187: echo "!!!! correct and taken care of !!!!"; \
188: echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
189: fi
190:
191: NET_webserverconf:
192: make TIMESTAMP=`date +"%s"` METAMTARGET="LAUNCH" \
193: MTARGET="webserverconf" HOSTNAME="$(HOSTNAME)" lpmladm
194:
195: webserverconf:
196: cat $(SOURCE)/doc/loncapafiles/webserver.piml | \
197: perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH)
198:
199: sanitycheck:
200: cat $(SOURCE)/doc/loncapafiles/sanitycheck.piml | \
201: perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
202: tee -a WARNINGS
203:
204: postinstall:
205: make webserverconf
206: make sanitycheck
207:
208: install: TEST_hosts_tab Makefile.install Makefile
209: echo -n "" > WARNINGS
210: make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
211: directories
212: make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
213: make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" links
214: make SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
215: NORESTORECONF="$(NORESTORECONF)" configinstall
216: make postinstall
217: make warningnote
218: echo "You can run 'make test' to see if your system is ready to go!"
219:
220: Makefile.install: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
221: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
222: perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
223: "$(TARGET)" > Makefile.install
224:
225: build: Makefile.build pod2html.sh pod2man.sh
226: echo -n "" > WARNINGS
227: make -f Makefile.build all
228: make warningnote
229:
230: Makefile.build: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
231: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
232: perl lpml_parse.pl build $(CATEGORY) $(DIST) "$(SOURCE)" "$(TARGET)" \
233: > Makefile.build
234:
235: RPM: BinaryRoot base_rpm_file_list
236: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
237: perl lpml_parse.pl make_rpm $(CATEGORY) $(DIST) $(SOURCE) $(TARGET) \
238: > base_customizerpm.xml
239: cat base_rpm_file_list.txt | perl make_rpm.pl base 3.2 '' '' \
240: BinaryRoot base_customizerpm.xml
241:
242: setup_RPM:
243: echo "SetupBinaryRoot/etc/passwd" > setup_rpm_file_list.txt
244: echo "SetupBinaryRoot/etc/group" >> setup_rpm_file_list.txt
245: echo "SetupBinaryRoot/etc/hosts.deny" >> setup_rpm_file_list.txt
246: echo "SetupBinaryRoot/home/www" >> setup_rpm_file_list.txt
247: echo "SetupBinaryRoot/etc/pam.d/passwd" >> setup_rpm_file_list.txt
248: echo "SetupBinaryRoot/etc/pam.d/login" >> setup_rpm_file_list.txt
249: perl setup_rpm_binaryroot.pl
250: cat setup_rpm_file_list.txt | perl make_rpm.pl setup 3.2 '' '' \
251: SetupBinaryRoot customizerpm.xml
252:
253: DPKG:
254: make TARGET='lon-capa-$(VERSION)' NORESTORECONF='1' install
255: @echo "You will next need to follow instructions at:"
256: @echo "http://people.debian.org/~jaldhar/make_package1.html"
257: @echo "A directory with a snapshot of the debian package files"
258: @echo "is LON-CAPA-base."
259: # What DPKG steps need to happen (for future implementation):
260: # export EMAIL="" ... probably sharrison@mail.lon-capa.org
261: # deb-make
262: # edit debian/control
263: # make debian/dirs file
264: # make debian/copyright file
265: # debian/README.debian... point them to LON-CAPA URLS
266: # debian/changelog
267: # debian/conffiles
268: # debuild
269: # and maybe do some GPG-related steps around here
270:
271: base_rpm_file_list:
272: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
273: perl lpml_parse.pl rpm_file_list $(CATEGORY) $(DIST) $(SOURCE) \
274: 'BinaryRoot' | sort > base_rpm_file_list.txt
275:
276: BinaryRoot: base_rpm_file_list
277: make TARGET='BinaryRoot' NORESTORECONF='1' install
278:
279: # Generates CVS:loncom/build/docs; root location of install.lon-capa.org
280: doc:
281: install -d docs
282: install -m 0755 -d docs/icons
283: install -m 0644 $(SOURCE)/doc/icons/[^C][^V]* docs/icons
284: install -m 0755 -d docs/reconfig
285: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
286: $(SOURCE)/doc/build/reconfig.html > docs/reconfig/index.html
287: install -m 0755 -d docs/reconfig/confexamples
288: install -m 0644 $(SOURCE)/doc/build/confexamples/[^C][^V]* \
289: docs/reconfig/confexamples
290: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
291: $(SOURCE)/doc/build/installindex.html > docs/index.html
292: install -m 0755 -d docs/license
293: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
294: $(SOURCE)/doc/build/license.html > docs/license/index.html
295: install -m 0755 -d docs/contact
296: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
297: $(SOURCE)/doc/build/contact.html > docs/contact/index.html
298: install -m 0755 -d docs/faq
299: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
300: $(SOURCE)/doc/build/faq.html > docs/faq/index.html
301: install -m 0755 -d docs/downloads
302: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
303: $(SOURCE)/doc/build/download.html > docs/downloads/index.html
304: install -m 0755 -d docs/install
305: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
306: $(SOURCE)/doc/build/install.html > docs/install/index.html
307: install -m 0755 -d docs/upgrade
308: perl doc_template.pl $(SOURCE)/doc/templates/template.html \
309: $(SOURCE)/doc/build/upgrade.html > docs/upgrade/index.html
310: cd docs; tar czvpf ../docs.tar.gz .
311:
312: documentation_tree: cvsreport
313: install -d docs
314: install $(SOURCE)/doc/build/cvsreport.html docs/cvsreport.html
315: install $(SOURCE)/doc/build/doc.html docs/index.html
316: install -d docs/hardware
317: install $(SOURCE)/doc/hardware/hardware.html \
318: docs/hardware/hardware.html
319: install -d docs/3.1
320: install $(SOURCE)/doc/build/install.html docs/3.1/index.html
321: install $(SOURCE)/doc/build/instructions_with_cd.html \
322: docs/3.1/instructions_with_cd.html
323: install $(SOURCE)/doc/build/libraryserverconfiguration.gif \
324: docs/3.1/libraryserverconfiguration.gif
325: install $(SOURCE)/doc/build/librarysystemsettings.gif \
326: docs/3.1/librarysystemsettings.gif
327: install -d docs/cvsupgrade
328: install $(SOURCE)/doc/build/cvsupgrade.html docs/cvsupgrade/index.html
329: install -d docs/upgrade
330: install $(SOURCE)/doc/build/upgrade.html docs/upgrade/index.html
331: install -d docs/reconfig
332: install $(SOURCE)/doc/build/reconfig.html docs/reconfig/index.html
333: install -d docs/3.1/otherfiles
334: install $(SOURCE)/doc/otherfiles/rpm_list.txt \
335: docs/3.1/otherfiles/rpm_list.txt
336: install $(SOURCE)/doc/build/loncapanetwork.html \
337: docs/loncapanetwork.html
338: install $(SOURCE)/doc/build/loncapanfs.html docs/loncapanfs.html
339: install $(SOURCE)/doc/build/loncapaappleshares.html \
340: docs/loncapaappleshares.html
341: install $(SOURCE)/doc/build/loncapasqldatabase.html \
342: docs/loncapasqldatabase.html
343: install $(SOURCE)/doc/build/loncapapasswords.html \
344: docs/loncapapasswords.html
345: install $(SOURCE)/doc/build/loncapapasswordauthentication.html \
346: docs/loncapapasswordauthentication.html
347: install $(SOURCE)/doc/build/loncapatimesync.html \
348: docs/loncapatimesync.html
349: install $(SOURCE)/doc/build/loncapamathequivalency.html \
350: docs/loncapamathequivalency.html
351: tar czvf install.lon-capa.org_docs.tar.gz docs
352: rm -Rf docs
353:
354: tardist:
355: cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
356: perl lpml_parse.pl MANIFEST development default \
357: '$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' > $(SOURCE)/MANIFEST
358: cat $(SOURCE)/doc/loncapafiles/buildfiles.lpml | \
359: perl lpml_parse.pl MANIFEST development default \
360: '$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
361: echo 'README' >> $(SOURCE)/MANIFEST
362: echo 'UPDATE' >> $(SOURCE)/MANIFEST
363: echo 'TEST' >> $(SOURCE)/MANIFEST
364: echo '#!/bin/sh' > $(SOURCE)/UPDATE
365: echo 'cd loncom/build; make build; make install' >> $(SOURCE)/UPDATE
366: echo '#!/bin/sh' > $(SOURCE)/TEST
367: echo 'cd loncom/build; make test' >> $(SOURCE)/TEST
368: chmod a+rx $(SOURCE)/UPDATE
369: chmod a+rx $(SOURCE)/TEST
370: cp $(SOURCE)/doc/shortest_path_redhat7.2.txt $(SOURCE)/README
371: cd $(SOURCE); \
372: tar --numeric-owner --files-from MANIFEST -czf loncapa.tar.gz \
373: 2>WARNINGS || [ "0" == "0" ]
374: cat $(SOURCE)/WARNINGS | \
375: xargs --replace=XXX echo '**** WARNING **** XXX' > WARNINGS
376: rm -f $(SOURCE)/WARNINGS
377: make warningnote
378:
379: cvsreport:
380:
381: clean:
382: rm -f $(SOURCE)/README
383: rm -f $(SOURCE)/UPDATE
384: rm -f $(SOURCE)/TEST
385: rm -f $(SOURCE)/loncapa.tar.gz
386: rm -Rf HTML
387: rm -f Makefile.build
388: rm -f Makefile.install
389: rm -f Makefile.configinstall
390: rm -Rf BinaryRoot
391: rm -Rf SetupBinaryRoot
392: rm -Rf LON-CAPA-base
393: rm -f base_rpm_file_list.txt
394: rm -f base_customizerpm.xml
395: rm -f setup_rpm_file_list.txt
396: rm -f docs.tar.gz
397: rm -Rf docs
398: rm -f program.pl*
399: rm -Rf lpmladm.*
400: make -f Makefile.cvs clean
401: rm -f WARNINGS
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>