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 # For more complete instructions, consult the INSTALL file
48 # that came with the bundle, and/or consult the installation
49 # documentation in one of the document directories.
51 # Please report any bugs, problems etc. with installing and using this bundle
52 # Makefile setup to glasgow-haskell-bugs@dcs.gla.ac.uk
55 # Where the different pieces of the bundle should go:
57 libdir = @libdir@/$(package)-$(version)
58 datadir = @datadir@/$(package)-$(version)
60 platform = @TargetPlatform@
62 exec_prefix = @exec_prefix@
65 htmldir = $(datadir)/html
83 INSTALL_DIR = ./mkdirhier
86 # Set of package scripts for which you'd like a name-<version> symlink
87 # to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to
88 # avoid version vertigo.
90 VERSION_SYMLINKS_FOR=$(PACKAGE_LINKS)
93 PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS)
95 #----------end of user-serviceable parts------------
98 # How to install the different pieces
100 INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS)
101 INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS)
102 INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)
104 # What's common to all installs
105 INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
110 INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
111 INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
112 INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
114 .PHONY: in-place config-pkgs mk-version-symlinks install-dirs install
117 @echo "Configuring $(package), version $(version), on $(platform) ..."
118 @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \
119 if test "$$i"; then \
120 echo "Creating a configured version of $$i .."; \
121 $(RM) bin/$(platform)/$$i.bak; \
122 if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
123 echo "#! $(PERL)" > bin/$(platform)/$$i ; \
124 echo '$$'"bindir='$(bindir)';" >> bin/$(platform)/$$i ; \
125 echo '$$'"libdir='$(libdir)';" >> bin/$(platform)/$$i ; \
126 echo '$$'"libexecdir='$(libdir)';" >> bin/$(platform)/$$i ; \
127 echo '$$'"datadir='$(datadir)';" >> bin/$(platform)/$$i ; \
128 echo '$$'"SED='$(SED)';" >> bin/$(platform)/$$i ; \
129 echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> bin/$(platform)/$$i ; \
130 cat bin/$(platform)/$$i.prl >> bin/$(platform)/$$i ; \
131 $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
135 @for i in $(PACKAGE_LIB_PRL_SCRIPTS) ""; do \
136 if test "$$i"; then \
137 echo "Creating a configured version of $$i .."; \
138 $(RM) lib/$(platform)/$$i.bak; \
139 if [ -f lib/$(platform)/$$i ]; then $(MV) lib/$(platform)/$$i lib/$(platform)/$$i.bak; fi; \
140 echo "#! $(PERL)" > lib/$(platform)/$$i ; \
141 echo '$$'"bindir='$(bindir)';" >> lib/$(platform)/$$i ; \
142 echo '$$'"libdir='$(libdir)';" >> lib/$(platform)/$$i ; \
143 echo '$$'"libexecdir='$(libdir)';" >> lib/$(platform)/$$i ; \
144 echo '$$'"datadir='$(datadir)';" >> lib/$(platform)/$$i ; \
145 echo '$$'"SED='$(SED)';" >> lib/$(platform)/$$i ; \
146 echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> lib/$(platform)/$$i ; \
147 cat lib/$(platform)/$$i.prl >> lib/$(platform)/$$i; \
148 $(CHMOD) $(BIN_PERMS) lib/$(platform)/$$i; \
152 @for i in $(PACKAGE_SH_SCRIPTS) ""; do \
153 if test "$$i"; then \
154 echo "Creating a configured version of $$i .."; \
155 $(RM) bin/$(platform)/$$i.bak; \
156 if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
157 echo "#! $(SH)" > bin/$(platform)/$$i ; \
158 echo "bindir='$(bindir)'" >> bin/$(platform)/$$i ; \
159 echo "libdir='$(libdir)'" >> bin/$(platform)/$$i ; \
160 echo "libexecdir='$(libdir)'" >> bin/$(platform)/$$i ; \
161 echo "datadir='$(datadir)'" >> bin/$(platform)/$$i ; \
162 echo "SED='$(SED)'" >> bin/$(platform)/$$i ; \
163 echo "DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)'" >> bin/$(platform)/$$i ; \
164 cat bin/$(platform)/$$i.sh >> bin/$(platform)/$$i; \
165 $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
169 @for i in $(PACKAGE_LIB_SPLICED_FILES) ""; do \
170 if test "$$i"; then \
171 echo "Creating a configured version of $$i .."; \
172 $(PERL) -i.bak -lpe 's|\$$libdir|$(libdir)|g;s|\$$datadir|$(datadir)|g' lib/$(platform)/$$i; \
175 @if test "$(platform)" = "powerpc-apple-darwin"; then \
176 echo "Configuring install names..."; \
177 for i in lib/$(platform)/*; do \
178 sh fix_install_names.sh "$(libdir)" "$$i"; \
184 $(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share
185 @if test -x "./post-inplace-script" ; then \
186 echo "Running project-specific post-inplace script ..." ; \
187 ./post-inplace-script $(platform) `pwd` \
188 $(package)-$(version); \
191 @echo "Finished configuring..to use, add `pwd`/bin/$(platform) to your PATH."
194 $(INSTALL_DIR) $(bindir)
195 (cd lib/$(platform); find . -type d -exec sh -c '../../$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; )
196 (cd share; find . -type d -exec sh -c '../$(INSTALL_DIR) $(datadir)/$$0' {} \; )
198 install :: config-pkgs install-dirs install-bin install-libs install-datas install-docs postinstall denounce
200 .PHONY: install-bin install-libs install-datas postinstall denounce
204 @echo =======================================================================
205 @echo Installation of $(package)-$(version) was successful.
207 @echo To use, add $(bindir) to your PATH.
209 @if test -f share/html/index.html; then \
210 echo For documentation, see $(htmldir)/index.html ; \
211 elif test -d share/html ; then \
212 echo Docs can be found in $(htmldir). ; \
214 echo "Warning: this binary distribution does NOT contain documentation!" ; \
216 @echo =======================================================================
219 @if test -x "./post-install-script" ; then \
220 echo "Running project-specific post-install script ..." ; \
221 ./post-install-script $(platform) $(libdir) ; \
226 for i in $(PACKAGE_BIN_INSTALL) ""; do \
227 if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i $(bindir); fi; \
229 for i in $(PACKAGE_BINS) ""; do \
230 if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
232 for i in $(PACKAGE_OPT_BINS) ""; do \
233 if test -n "$$i" -a ! -f "$(bindir)/$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
235 @for i in $(VERSION_SYMLINKS_FOR) ""; do \
236 if [ "x$$i" != "x" ]; then \
238 if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
239 echo "Creating a symbolic link from $$i-$(version) to $$i"; \
241 $(LN_S) $$i-$(version) $$i; \
243 echo "Creating a symbolic link from $$i-$(version) to $$i failed: \`$$i' already exists"; \
244 echo "Perhaps remove \`$$i' manually?"; \
253 (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; )
256 for i in `(cd share; find . -type f )`; do \
257 $(INSTALL_DATA) share/$$i $(datadir)/$$i; \
261 @echo "Install setup..."
262 @echo "bindir = $(bindir)"
263 @echo "libdir = $(libdir) (libdir = $(libdir))"
264 @echo "datadir = $(datadir) (datadir = $(datadir))"
267 # Documentation targets: install-docs.
270 .PHONY: show-install-setup install-docs install-dirs-docs
272 install-docs : install-dirs-docs
273 if test -d share/html ; then $(CP) -r share/html/* $(htmldir) ; fi
274 for i in share/*.ps; do \
275 if test -f "$$i"; then \
276 $(CP) $$i $(psdir) ; \
281 $(INSTALL_DIR) $(htmldir)