Skip to content

Commit

Permalink
Make Makefile.NEW Makefile; add template-check to CHANGES and MANIFEST
Browse files Browse the repository at this point in the history
  • Loading branch information
pudge committed Mar 14, 2001
1 parent 7913bf9 commit 2663b8a
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 52 deletions.
3 changes: 2 additions & 1 deletion CHANGES
@@ -1,4 +1,4 @@
slash-1.1.6-bender, 2000.03.13
slash-1.1.6-bender, 2000.03.14
------------------------------

* Major overhaul of command-line tools; many options have changed;
Expand Down Expand Up @@ -79,6 +79,7 @@ slash-1.1.6-bender, 2000.03.13

* Fix Search to work

* Added template-check program


slash-1.1.5-bender, 2000.03.02
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -94,6 +94,7 @@ bin/backup-blocks
bin/install-plugin
bin/install-slashsite
bin/tailslash
bin/template-check
bin/template-tool
docs/HOWTO-Plugins.pod
docs/HOWTO-Templates.pod
Expand Down
190 changes: 139 additions & 51 deletions Makefile
Expand Up @@ -25,11 +25,31 @@ PREOP = @$(NOOP)
POSTOP = @$(NOOP)
TO_UNIX = @$(NOOP)
SLASH_PREFIX = /usr/local/slash
# If this isn't used anymore, can we remove it?
INIT = /etc
USER = nobody
GROUP = nobody
CP = cp

# Plugins (any directory in plugins/)
PLUGINS = `find . -name CVS -prune -o -type d -maxdepth 1 -print`

# Perl scripts, grouped by directory.
BINFILES = `find bin -name CVS -prune -o -type f -print`
SBINFILES = `find sbin -name CVS -prune -o -type f -print`
THEMEFILES = `find themes -name CVS -prune -o -name \*.pl -print`
PLUGINFILES = `find plugins -name CVS -prune -o -name \*.pl -print`

# What do we use to invoke perl?
REPLACEWITH = `$(PERL) -MConfig -e 'print $$Config{startperl}' | sed 's/@/\\@/g'`

# Scripts that need special treatment for $(SLASH_PREFIX)
PREFIX_REPLACE_FILES = utils/slash httpd/slash.conf

# Used by the RPM build.
BUILDROOT=/var/tmp/slash-buildroot
INSTALLSITEARCH=`$(PERL) -MConfig -e 'print "$(BUILDROOT)/$$Config{installsitearch}"'`
INSTALLSITELIB=`$(PERL) -MConfig -e 'print "$(BUILDROOT)/$$Config{installsitelib}"'`

# install the shared object file into Apache
# We should run a script on the binaries to get the right
Expand All @@ -39,74 +59,142 @@ slash:
if ! [ $(RPM) ] ; then \
(cd Slash; $(PERL) Makefile.PL; make); \
else \
(cd Slash; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make); \
(cd Slash; $(PERL) Makefile.PL INSTALLSITEARCH=$(INSTALLSITEARCH) INTALLSITELIB=$(INSTALLSITELIB); make); \
fi

plugins:
if ! [ $(RPM) ] ; then \
(cd plugins/Search; $(PERL) Makefile.PL; make); \
(cd plugins/Journal; $(PERL) Makefile.PL; make); \
(cd plugins/Ladybug; $(PERL) Makefile.PL; make); \
else \
(cd plugins/Search; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make); \
(cd plugins/Journal; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make); \
(cd plugins/Ladybug; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make); \
fi
(cd plugins; \
for a in $(PLUGINS); do \
(cd $$a; \
if [ -f Makefile.PL ]; then \
if ! [ $(RPM) ] ; then \
$(PERL) Makefile.PL; make;\
else \
$(PERL) Makefile.PL INSTALLSITEARCH=$(INSTALLSITEARCH) INSTALLSITELIB=$(INSTALLSITELIB); make; \
fi
fi);
fi)

all: install

install: slash plugins
# Need to toss in a script here that will fix prefix so
# that if someone wants to install in a different
# directory it will be easy
# Lets go install the libraries
(cd Slash; make install)
# Lets go install the libraries, remember to clean out old versions.
(cd Slash; make install UNINST=1)
# Lets go install the plugin's libraries
if ! [ $(RPM) ] ; then \
(cd plugins/Search; $(PERL) Makefile.PL; make install); \
(cd plugins/Journal; $(PERL) Makefile.PL; make install); \
(cd plugins/Ladybug; $(PERL) Makefile.PL; make install); \
else \
(cd plugins/Search; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make install); \
(cd plugins/Journal; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make install); \
(cd plugins/Ladybug; $(PERL) Makefile.PL INSTALLSITEARCH=/var/tmp/slash-buildroot/usr/local/lib/perl/5.6.0 INSTALLSITELIB=/var/tmp/slash-buildroot/usr/local/share/perl/5.6.0; make install); \
fi
#
# If 'plugins' is already a dependency, why do we need to regenerate the
# Makefile? - Cliff
(cd plugins; \
for a in $(PLUGINS); do \
(cd $$a; \
if [ -f Makefile ]; then \
make install; \
elif [ -f Makefile.PL ]; then \
if ! [ $(RPM) ] ; then \
$(PERL) Makefile.PL; \
else \
$(PERL) Makefile.PL INSTALLSITEARCH=$(INSTALLSITEARCH) INSTALLSITELIB=$(INSTALLSITELIB); \
fi; \
make install; \
fi); \
done)

# Create all necessary directories.
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/

# Insure we use the proper perl interpreter and prefix in all scripts that
# we install. Note the use of Perl as opposed to dirname(1) and basename(1)
# which may or may not exist on any given system.
(replacewith=$(REPLACEWITH); \
binfiles=$(BINFILES); \
sbinfiles=$(SBINFILES); \
themefiles=$(THEMEFILES); \
pluginfiles=$(PLUGINFILES); \
if [ "$$replacewith" != "#!/usr/bin/perl" ]; then \
replace=1; \
replacestr='(using $(PERL))'; \
else \
replace=0; \
fi; \
for f in $$binfiles $$sbinfiles $$themefiles $$pluginfiles; do \
if [ $$replace ]; then \
b=`echo $$f | $(PERL) -MFile::Basename -e 'print basename(<STDIN>)'`; \
d=`echo $$f | $(PERL) -MFile::Basename -e 'print dirname(<STDIN>)'`; \
$(PERL) -i.bak -pe "s@#!/usr/bin/perl@$$replacewith@ if $$. == 1" $$f; \
fi; \
echo "Installing '$$f' in $(SLASH_PREFIX)/$$d $$replacestr"; \
install -d $(SLASH_PREFIX)/$$d; \
install $$f $(SLASH_PREFIX)/$$d/$$b; \
if [ -f "$$f.bak" ]; then \
rm $$f; mv $$f.bak $$f; \
fi; \
done)

# First we do the default stuff
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)/plugins/ $(SLASH_PREFIX)/httpd/
install -D bin/install-slashsite bin/install-plugin bin/tailslash bin/template-tool $(SLASH_PREFIX)/bin/
install -D sbin/slashd sbin/portald sbin/moderatord sbin/dailyStuff $(SLASH_PREFIX)/sbin/
$(CP) sql/mysql/slashschema_create.sql $(SLASH_PREFIX)/sql/mysql/schema.sql
$(CP) sql/postgresql/slashschema_create.sql $(SLASH_PREFIX)/sql/postgresql/schema.sql

if [ -f $(SLASH_PREFIX)/httpd/slash.conf ]; then\
echo "Preserving old slash.conf"; \
else \
$(CP) httpd/slash.conf $(SLASH_PREFIX)/httpd/slash.conf; \
fi

$(CP) httpd/slash.conf $(SLASH_PREFIX)/httpd/slash.conf.def

# Note the use of -u in the copy commands below. We don't want to
# overwrite any of the perl scritps we've already modified and put
# into place!

# Now for the default theme (be nice when this goes in themes)
(cd plugins; make clean)
$(CP) -r plugins/* $(SLASH_PREFIX)/plugins/
# Now for the plugins.
(cd plugins; make clean)
$(CP) -ruv plugins/* $(SLASH_PREFIX)/plugins/
# Now all other themes
$(CP) -r themes/* $(SLASH_PREFIX)/themes

# this needs BSD support
if [ -d /etc/init.d ]; then \
install utils/slash /etc/init.d/; \
ln -s -f /etc/init.d/slash /etc/rc3.d/S99slash; \
ln -s -f /etc/init.d/slash /etc/rc6.d/K99slash; \
elif [ -d /etc/rc.d ]; then \
install utils/slash /etc/rc.d/init.d/; \
ln -s -f /etc/rc.d/init.d/slash /etc/rc.d/rc3.d/S99slash; \
ln -s -f /etc/rc.d/init.d/slash /etc/rc.d/rc6.d/K99slash; \
else \
echo "This is either BSD or some other OS I do not understand"; \
echo "You will need to look at how to install utils/slash"; \
fi
$(CP) -ruv themes/* $(SLASH_PREFIX)/themes

# This needs BSD support (and Solaris)...
# ... and the $(SLASH_PREFIX) section is a really ugly hack, too.
(if [ "$(SLASH_PREFIX)" != "/usr/local/slash" ]; then \
replace=1; \
fi; \
for a in $(PREFIX_REPLACE_FILES); do \
if [ $$replace ]; then \
perl -i.bak -pe 's{/usr/local/slash}{$(SLASH_PREFIX)}' $$a; \
fi; \
case "$$a" in \
'utils/slash') \
if [ "$(INIT)" != "/etc" ]; then \
if [ -d $(INIT) ]; then \
init=$(INIT); \
fi; \
elif [ -d /etc/init.d ]; then \
init=/etc; \
elif [ -d /etc/rc.d/init.d ]; then \
init=/etc/rc.d; \
fi; \
if [ $$init ]; then \
install utils/slash $$init/init.d/; \
ln -s -f ../init.d/slash $$init/rc3.d/S99slash; \
ln -s -f ../init.d/slash $$init/rc6.d/K99slash; \
else \
echo "*** Makefile can't determine where your init scripts live."; \
if [ $$init ]; then \
echo "*** ('$(INIT)' does not exist)"; \
fi; \
echo "*** You will need to look at how to install utils/slashd"; \
echo "*** on your own."; \
fi; \
;; \
'httpd/slash.conf') \
if [ -f $(SLASH_PREFIX)/httpd/slash.conf ]; then \
echo "Preserving old slash.conf"; \
else \
$(CP) httpd/slash.conf $(SLASH_PREFIX)/httpd/slash.conf; \
fi; \
$(CP) httpd/slash.conf $(SLASH_PREFIX)/httpd/slash.conf.def; \
;; \
*) \
install $$a $(SLASH_PREFIX)/$$a \
;; \
esac; \
if [ $$replace ]; then \
mv $$a.bak $$a; \
fi; \
done)

touch $(SLASH_PREFIX)/slash.sites
chown $(USER):$(GROUP) $(SLASH_PREFIX)
Expand Down

0 comments on commit 2663b8a

Please sign in to comment.