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