Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 250 lines (222 sloc) 8.556 kB
d8359ff @BrianAker Fry :)
BrianAker authored
1 # This code is a part of Slash, and is released under the GPL.
c0e7999 @pudge Update 2005, OSTG, etc.
pudge authored
2 # Copyright 1997-2005 by Open Source Technology Group. See README
d8359ff @BrianAker Fry :)
BrianAker authored
3 # and COPYING for more information, or see http://slashcode.com/.
4 # $Id$
5
6 ##
7 ## Makefile -- Current one for Slash
8 ##
9
10 # the used tools
11 VERSION = 1.1.6-bender
12 DISTNAME = slash
13 DISTVNAME = $(DISTNAME)-$(VERSION)
14
15 SHELL = /bin/sh
16 PERL = perl
17 NOOP = $(SHELL) -c true
18 RM_RF = rm -rf
19 RM = rm -f
20 SUFFIX = .gz
21 COMPRESS = gzip --best
22 TAR = tar
23 TARFLAGS = cvf
24 PREOP = @$(NOOP)
25 POSTOP = @$(NOOP)
26 TO_UNIX = @$(NOOP)
27 SLASH_PREFIX = /usr/local/slash
28 # If this isn't used anymore, can we remove it?
29 INIT = /etc
30 USER = nobody
31 GROUP = nobody
32 CP = cp
33
34 # Plugins (any directory in plugins/)
2951fd2 @jamiemccarthy Minor fix to eliminate this minor warning:
jamiemccarthy authored
35 PLUGINS = `find . -maxdepth 1 -name CVS -prune -o -type d -print`
d8359ff @BrianAker Fry :)
BrianAker authored
36
37 # Perl scripts, grouped by directory.
38 BINFILES = `find bin -name CVS -prune -o -type f -print`
39 SBINFILES = `find sbin -name CVS -prune -o -type f -print`
40 THEMEFILES = `find themes -name CVS -prune -o -name \*.pl -print`
41 PLUGINFILES = `find plugins -name CVS -prune -o -name \*.pl -print`
42
43 # What do we use to invoke perl?
44 REPLACEWITH = `$(PERL) -MConfig -e 'print $$Config{startperl}' | sed 's/@/\\@/g'`
45
46 # Scripts that need special treatment for $(SLASH_PREFIX)
47 PREFIX_REPLACE_FILES = utils/slash httpd/slash.conf
48
49 # Used by the RPM build.
50 BUILDROOT=/var/tmp/slash-buildroot
51 INSTALLSITEARCH=`$(PERL) -MConfig -e 'print "$(BUILDROOT)/$$Config{installsitearch}"'`
52 INSTALLSITELIB=`$(PERL) -MConfig -e 'print "$(BUILDROOT)/$$Config{installsitelib}"'`
53 INSTALLMAN3DIR=`$(PERL) -MConfig -e 'print "$(BUILDROOT)/$$Config{installman3dir}"'`
54
55 # install the shared object file into Apache
56 # We should run a script on the binaries to get the right
57 # version of perl.
58 # I should also grab an install-sh instead of using $(CP)
59 slash:
60 if ! [ $(RPM) ] ; then \
61 (cd Slash; $(PERL) Makefile.PL; make); \
62 else \
63 (cd Slash; $(PERL) Makefile.PL INSTALLSITEARCH=$(INSTALLSITEARCH) INSTALLSITELIB=$(INSTALLSITELIB) INSTALLMAN3DIR=$(INSTALLMAN3DIR); make); \
64 fi
65
66 plugins:
67 (cd plugins; \
68 for a in $(PLUGINS); do \
69 (cd $$a; \
70 if [ -f Makefile.PL ]; then \
71 if ! [ $(RPM) ] ; then \
72 $(PERL) Makefile.PL; make;\
73 else \
74 $(PERL) Makefile.PL INSTALLSITEARCH=$(INSTALLSITEARCH) INSTALLSITELIB=$(INSTALLSITELIB) INSTALLMAN3DIR=$(INSTALLMAN3DIR); make; \
75 fi
76 fi);
77 fi)
78
79 all: install
80
81 install: slash plugins
82 # Need to toss in a script here that will fix prefix so
83 # that if someone wants to install in a different
84 # directory it will be easy
85 # Lets go install the libraries, remember to clean out old versions.
86 (cd Slash; make install UNINST=1)
87 # Lets go install the plugin's libraries
88 #
89 # If 'plugins' is already a dependency, why do we need to regenerate the
90 # Makefile? - Cliff
91 (cd plugins; \
92 for a in $(PLUGINS); do \
93 (cd $$a; \
94 if [ -f Makefile ]; then \
95 make install; \
96 elif [ -f Makefile.PL ]; then \
97 if ! [ $(RPM) ] ; then \
98 $(PERL) Makefile.PL; \
99 else \
100 $(PERL) Makefile.PL INSTALLSITEARCH=$(INSTALLSITEARCH) INSTALLSITELIB=$(INSTALLSITELIB) INSTALLMAN3DIR=$(INSTALLMAN3DIR); \
101 fi; \
102 make install; \
103 fi); \
104 done)
105
106 # Create all necessary directories.
107 install -d $(SLASH_PREFIX)/bin/ $(SLASH_PREFIX)/sbin $(SLASH_PREFIX)/sql/ $(SLASH_PREFIX)/sql/mysql/ $(SLASH_PREFIX)/sql/postgresql $(SLASH_PREFIX)/themes/ $(SLASH_PREFIX)/themes/slashcode/htdocs/ $(SLASH_PREFIX)/themes/slashcode/sql/ $(SLASH_PREFIX)/themes/slashcode/sql/postgresql $(SLASH_PREFIX)/themes/slashcode/sql/mysql $(SLASH_PREFIX)/themes/slashcode/backup $(SLASH_PREFIX)/themes/slashcode/logs/ $(SLASH_PREFIX)/plugins/ $(SLASH_PREFIX)/httpd/
108
109 # Insure we use the proper perl interpreter and prefix in all scripts that
110 # we install. Note the use of Perl as opposed to dirname(1) and basename(1)
111 # which may or may not exist on any given system.
112 (replacewith=$(REPLACEWITH); \
113 binfiles=$(BINFILES); \
114 sbinfiles=$(SBINFILES); \
115 themefiles=$(THEMEFILES); \
116 pluginfiles=$(PLUGINFILES); \
117 if [ "$$replacewith" != "#!/usr/bin/perl" ]; then \
118 replace=1; \
119 replacestr='(using $(PERL))'; \
120 else \
121 replace=0; \
122 fi; \
123 for f in $$binfiles $$sbinfiles $$themefiles $$pluginfiles; do \
124 if [ $$replace ]; then \
125 b=`echo $$f | $(PERL) -MFile::Basename -e 'print basename(<STDIN>)'`; \
126 d=`echo $$f | $(PERL) -MFile::Basename -e 'print dirname(<STDIN>)'`; \
127 $(PERL) -i.bak -pe "s@#!/usr/bin/perl@$$replacewith@ if $$. == 1" $$f; \
128 fi; \
129 echo "Installing '$$f' in $(SLASH_PREFIX)/$$d $$replacestr"; \
130 install -d $(SLASH_PREFIX)/$$d; \
131 install $$f $(SLASH_PREFIX)/$$d/$$b; \
132 if [ -f "$$f.bak" ]; then \
133 rm $$f; mv $$f.bak $$f; \
134 fi; \
135 done)
136
137 $(CP) sql/mysql/slashschema_create.sql $(SLASH_PREFIX)/sql/mysql/schema.sql
138 $(CP) sql/postgresql/slashschema_create.sql $(SLASH_PREFIX)/sql/postgresql/schema.sql
139
140 # Note the use of -u in the copy commands below. We don't want to
141 # overwrite any of the perl scritps we've already modified and put
142 # into place!
143
144 # Now for the plugins.
145 (cd plugins; make clean)
146 $(CP) -ruv plugins/* $(SLASH_PREFIX)/plugins/
147 # Now all other themes
148 $(CP) -ruv themes/* $(SLASH_PREFIX)/themes
149
150 # This needs BSD support (and Solaris)...
151 # ... and the $(SLASH_PREFIX) section is a really ugly hack, too.
152 (if [ "$(SLASH_PREFIX)" != "/usr/local/slash" ]; then \
153 replace=1; \
154 fi; \
155 for a in $(PREFIX_REPLACE_FILES); do \
156 if [ $$replace ]; then \
157 perl -i.bak -pe 's{/usr/local/slash}{$(SLASH_PREFIX)}' $$a; \
158 fi; \
159 case "$$a" in \
160 'utils/slash') \
161 if [ "$(INIT)" != "/etc" ]; then \
162 if [ -d $(INIT) ]; then \
163 init=$(INIT); \
164 fi; \
165 elif [ -d /etc/init.d ]; then \
166 init=/etc; \
167 elif [ -d /etc/rc.d/init.d ]; then \
168 init=/etc/rc.d; \
169 fi; \
170 if [ $$init ]; then \
171 install utils/slash $$init/init.d/; \
172 ln -s -f ../init.d/slash $$init/rc3.d/S99slash; \
173 ln -s -f ../init.d/slash $$init/rc6.d/K99slash; \
174 else \
175 echo "*** Makefile can't determine where your init scripts live."; \
176 if [ $$init ]; then \
177 echo "*** ('$(INIT)' does not exist)"; \
178 fi; \
179 echo "*** You will need to look at how to install utils/slashd"; \
180 echo "*** on your own."; \
181 fi; \
182 ;; \
183 'httpd/slash.conf') \
184 if [ -f $(SLASH_PREFIX)/httpd/slash.conf ]; then \
185 echo "Preserving old slash.conf"; \
186 else \
187 $(CP) httpd/slash.conf $(SLASH_PREFIX)/httpd/slash.conf; \
188 fi; \
189 $(CP) httpd/slash.conf $(SLASH_PREFIX)/httpd/slash.conf.def; \
190 ;; \
191 *) \
192 install $$a $(SLASH_PREFIX)/$$a \
193 ;; \
194 esac; \
195 if [ $$replace ]; then \
196 mv $$a.bak $$a; \
197 fi; \
198 done)
199
200 touch $(SLASH_PREFIX)/slash.sites
201 chown $(USER):$(GROUP) $(SLASH_PREFIX)
202 chown -R $(USER):$(GROUP) $(SLASH_PREFIX)/themes
203 chown -R $(USER):$(GROUP) $(SLASH_PREFIX)/sbin
204 chown -R $(USER):$(GROUP) $(SLASH_PREFIX)/bin
205 chown -R $(USER):$(GROUP) $(SLASH_PREFIX)/sql
206 chown -R $(USER):$(GROUP) $(SLASH_PREFIX)/plugins
207 # Add a @ to suppress output of the echo's
208 @echo "+--------------------------------------------------------+"; \
209 echo "| All done. |"; \
210 echo "| If you want to let Slash handle your httpd.conf file |"; \
211 echo "| go add: |"; \
212 echo "| |"; \
213 echo "| Include $(SLASH_PREFIX)/httpd/slash.conf |"; \
214 echo "| |"; \
215 echo "| to your httpd.conf for apache. |"; \
216 echo "| If not, cat its content into your httpd.conf file. |"; \
217 echo "| |"; \
218 echo "| Thanks for installing Slash. |"; \
219 echo "+--------------------------------------------------------+"; \
220
221
222 reload: install
223 apachectl stop
224 apachectl start
225 # cleanup
226 clean:
227
228 dist: $(DISTVNAME).tar$(SUFFIX)
229
230 $(DISTVNAME).tar$(SUFFIX) : distdir
231 $(PREOP)
232 $(TO_UNIX)
233 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
234 $(RM_RF) $(DISTVNAME)
235 $(COMPRESS) $(DISTVNAME).tar
236 $(POSTOP)
237
238 distdir :
239 $(RM_RF) $(DISTVNAME)
240 $(PERL) -MExtUtils::Manifest=manicopy,maniread \
241 -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
242
243 manifest :
244 (cd Slash; make distclean)
245 $(PERL) -MExtUtils::Manifest -e 'ExtUtils::Manifest::mkmanifest'
246
247 rpm :
248 rpm -ba slash.spec
249
Something went wrong with that request. Please try again.