4 # Instructions for configuring an fptools package.
6 # There are two ways you can get started with an fptools package, either
7 # by using the unpacked distribution tree in-situ or by installing the
10 # Using the package directly is easy, just do `make in-place'. (The
11 # distribution will *not* work straight out of the box, you'll have to do
14 # To install the package, you'll have to set one or more of the
15 # following variables:
18 # path to directory of where you want the executables
21 # where you want the library archives to go.
22 # Note, if you specify /usr/foo/lib for libdir,
23 # the library files for your fptools package will be
24 # installed in /usr/foo/lib/<package>-<version>, e.g.,
25 # /usr/foo/lib/ghc-3.00. If you don't want the package/version
26 # directory appended, you'll have to modify $(real_libdir)
30 # path to where the platform-independent files will go.
31 # As for libdir, the effective path for the platform-indep
32 # stuff is $(datadir)/<package>-<version>. If you want
33 # complete control, see $(real_datadir)
36 # the platform you're installing for. The configure script
37 # makes an educated guess, so you'll only have to set this
38 # if it clashes with your reality, I guess.
41 # where to install the HTML documentation files.
43 # where to install the PDF documentation files.
45 # where to install the Postscript documentation files.
47 # Installing the documentation is not done as part of the `install' rule, but
48 # via `install-docs' (or if you want to be selective: `install-html', `install-dvi'
49 # and `install-info').
51 # For more complete instructions, consult the INSTALL file
52 # that came with the bundle, and/or consult the installation
53 # documentation in one of the document directories.
55 # Please report any bugs, problems etc. with installing and using this bundle
56 # Makefile setup to glasgow-haskell-bugs@dcs.gla.ac.uk
59 # Where the different pieces of the bundle should go:
61 libdir = @libdir@/$(package)-$(version)
62 datadir = @datadir@/$(package)-$(version)
64 platform = @TargetPlatform@
66 exec_prefix = @exec_prefix@
87 INSTALL_DIR = ./mkdirhier
90 # Set of package scripts for which you'd like a name-<version> symlink
91 # to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to
92 # avoid version vertigo.
94 VERSION_SYMLINKS_FOR=$(PACKAGE_LINKS)
97 PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS)
99 #----------end of user-serviceable parts------------
102 # How to install the different pieces
104 INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS)
105 INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS)
106 INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)
108 # What's common to all installs
109 INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
114 INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
115 INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
116 INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
118 .PHONY: in-place config-pkgs mk-version-symlinks install-dirs install
121 @echo "Configuring $(package), version $(version), on $(platform) ..."
122 @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \
123 if test "$$i"; then \
124 echo "Creating a configured version of $$i .."; \
125 $(RM) bin/$(platform)/$$i.bak; \
126 if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
127 echo "#! $(PERL)" > bin/$(platform)/$$i ; \
128 echo '$$'"bindir='$(bindir)';" >> bin/$(platform)/$$i ; \
129 echo '$$'"libdir='$(libdir)';" >> bin/$(platform)/$$i ; \
130 echo '$$'"libexecdir='$(libdir)';" >> bin/$(platform)/$$i ; \
131 echo '$$'"datadir='$(datadir)';" >> bin/$(platform)/$$i ; \
132 echo '$$'"SED='$(SED)';" >> bin/$(platform)/$$i ; \
133 echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> bin/$(platform)/$$i ; \
134 cat bin/$(platform)/$$i.prl >> bin/$(platform)/$$i ; \
135 $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
139 @for i in $(PACKAGE_LIB_PRL_SCRIPTS) ""; do \
140 if test "$$i"; then \
141 echo "Creating a configured version of $$i .."; \
142 $(RM) lib/$(platform)/$$i.bak; \
143 if [ -f lib/$(platform)/$$i ]; then $(MV) lib/$(platform)/$$i lib/$(platform)/$$i.bak; fi; \
144 echo "#! $(PERL)" > lib/$(platform)/$$i ; \
145 echo '$$'"bindir='$(bindir)';" >> lib/$(platform)/$$i ; \
146 echo '$$'"libdir='$(libdir)';" >> lib/$(platform)/$$i ; \
147 echo '$$'"libexecdir='$(libdir)';" >> lib/$(platform)/$$i ; \
148 echo '$$'"datadir='$(datadir)';" >> lib/$(platform)/$$i ; \
149 echo '$$'"SED='$(SED)';" >> lib/$(platform)/$$i ; \
150 echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> lib/$(platform)/$$i ; \
151 cat lib/$(platform)/$$i.prl >> lib/$(platform)/$$i; \
152 $(CHMOD) $(BIN_PERMS) lib/$(platform)/$$i; \
156 @for i in $(PACKAGE_SH_SCRIPTS) ""; do \
157 if test "$$i"; then \
158 echo "Creating a configured version of $$i .."; \
159 $(RM) bin/$(platform)/$$i.bak; \
160 if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
161 echo "#! $(SH)" > bin/$(platform)/$$i ; \
162 echo "bindir='$(bindir)'" >> bin/$(platform)/$$i ; \
163 echo "libdir='$(libdir)'" >> bin/$(platform)/$$i ; \
164 echo "libexecdir='$(libdir)'" >> bin/$(platform)/$$i ; \
165 echo "datadir='$(datadir)'" >> bin/$(platform)/$$i ; \
166 echo "SED='$(SED)'" >> bin/$(platform)/$$i ; \
167 echo "DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)'" >> bin/$(platform)/$$i ; \
168 cat bin/$(platform)/$$i.sh >> bin/$(platform)/$$i; \
169 $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
174 # Convert pwd's UNC reported path into DOS style
176 CURRENT_DIR = $(shell pwd | sed 's|^//\(.\)|\1:|' )
179 $(MAKE) $(MFLAGS) config-pkgs bindir=$(CURRENT_DIR)/bin/$(platform) libdir=$(CURRENT_DIR)/lib/$(platform) datadir=$(CURRENT_DIR)/share
180 if test -x "./post-inplace-script" ; then \
181 echo "Running project-specific post-inplace script ..." ; \
182 ./post-inplace-script $(platform) $(CURRENT_DIR) \
183 $(package)-$(version); \
186 @echo "Finished configuring..to use, add $(CURRENT_DIR)/bin/$(platform) to your PATH."
189 $(INSTALL_DIR) $(bindir)
190 (cd lib/$(platform); find . -type d -exec sh -c '../../$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; )
191 (cd share; find . -type d -exec sh -c '../$(INSTALL_DIR) $(datadir)/$$0' {} \; )
193 install :: config-pkgs install-dirs install-bin install-libs install-datas install-docs postinstall denounce
195 .PHONY: install-bin install-libs install-datas postinstall denounce
199 @echo =======================================================================
200 @echo Installation of $(package)-$(version) was successful.
201 @echo To use, add $(bindir) to your PATH.
202 @if test -d html ; then \
203 echo Docs can be found in $(htmldir). ; \
205 echo "Warning: this binary distribution does NOT contain documentation!" ; \
207 @echo =======================================================================
210 @if test -x "./post-install-script" ; then \
211 echo "Running project-specific post-install script ..." ; \
212 ./post-install-script $(platform) $(libdir) ; \
217 for i in $(PACKAGE_BIN_INSTALL) ""; do \
218 if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i $(bindir); fi; \
220 for i in $(PACKAGE_BINS) ""; do \
221 if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
223 @for i in $(VERSION_SYMLINKS_FOR) ""; do \
224 if [ "x$$i" != "x" ]; then \
226 if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
227 echo "Creating a symbolic link from $$i-$(version) to $$i"; \
229 $(LN_S) $$i-$(version) $$i; \
231 echo "Creating a symbolic link from $$i-$(version) to $$i failed: \`$$i' already exists"; \
232 echo "Perhaps remove \`$$i' manually?"; \
241 (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; )
244 (cd share; find . -type f -exec sh -c '$(INSTALL_DATA) $$0 $(datadir)/$$0' {} \; )
247 @echo "Install setup..."
248 @echo "bindir = $(bindir)"
249 @echo "libdir = $(libdir) (libdir = $(libdir))"
250 @echo "datadir = $(datadir) (datadir = $(datadir))"
253 # Documentation targets: install-docs.
256 .PHONY: show-install-setup install-docs install-dirs-docs
258 install-docs : install-dirs-docs
259 if test -d html ; then $(CP) -r html/* $(htmldir) ; fi
260 if test -f ps/*.ps ; then $(CP) ps/*.ps $(psdir) ; fi
263 $(INSTALL_DIR) $(htmldir)