|
Changes to make fptools insfrastructure usable for standalone libraries: msg#00018lang.haskell.glasgow.bugs
I've been trying to use the existing fptools infrastructure (i.e., configure.in and mk/*.mk) to build standalone libraries. That is, I'm aiming at the situation where someone has already installed ghc, greencard, happy, and all the other build tools they might need and now they want to install libX11 using a canonical sequence like: tar zxvf libHSX11.tar.gz cd libHSX11 ./configure make depend make make install which will build the library and install the package. Hopefully you agree that this is a desirable goal (if it doesn't messup ghc too much). I seem to have this working and I've committed a bunch of the minor changes which shouldn't break anything. I'd like comments on the remaining changes and problems. 1) fptools/mk/target.mk At the moment, the depend target depends on $(STAMP_PKG_CONF) which is built when libraries are installed using ghc-pkg. This puzzles me because I can't install before I build the library and I can't build the library until I 'make depend'. I think this dependency should be dropped diff -c -C2 -r1.173 target.mk *** target.mk 27 Apr 2003 10:30:13 -0000 1.173 --- target.mk 17 May 2003 14:52:02 -0000 *************** *** 84,88 **** endif ! depend :: $(MKDEPENDHS_SRCS) $(MKDEPENDC_SRCS) $(STAMP_PKG_CONF) @$(RM) .depend @touch .depend --- 84,88 ---- endif ! depend :: $(MKDEPENDHS_SRCS) $(MKDEPENDC_SRCS) @$(RM) .depend @touch .depend 2) fptools/mk/path.mk At the moment, files are installed using the install-sh script but directories are installed using mkdirhier. I'd like to drop this dependency so that the build infrastructure can omit this program. As far as I know, install-sh -d is a fine alternative. [How much of the glafp-utils infrastructure do I actually need? I'm not sure but I think mkdirhier is the only tool which isn't provided in a debian/ redhat/ etc package. Obviously, if it turned out that some of the glafp-utils were indispensible, this change would be less compelling.] diff -c -C2 -r1.50 paths.mk *** paths.mk 11 Apr 2003 12:24:30 -0000 1.50 --- paths.mk 17 May 2003 14:52:01 -0000 *************** *** 57,61 **** INSTALL_SHLIB = $(INSTALL) -m 755 INSTALL_DATA = $(INSTALL) -m 644 ! INSTALL_DIR = $(FPTOOLS_TOP)/glafp-utils/mkdirhier/mkdirhier # --- 57,61 ---- INSTALL_SHLIB = $(INSTALL) -m 755 INSTALL_DATA = $(INSTALL) -m 644 ! INSTALL_DIR = $(INSTALL) -d 3) fptools/mk/package.mk [diffs are long so they're appended to end of mail] package.mk contains many references to things defined in ghc/mk/paths.mk: GHC_INCLUDE_DIR GHC_DRIVER_DIR GHC_PKG_INPLACE GHC_INPLACE I have hacked round these references by inserting ugly code like: + ifeq "$(GHC_INCLUDE_DIR)" "" + GHC_INCLUDE_DIR=<whatever> + endif Ideas on how to clean this up welcome. The file $(STAMP_PKG_CONF), which is built when a package is installed, should depend on $(LIBRARY) Swapping the stuff for building libraries with the stuff for installing libraries allows $(STAMP_PKG_CONF) to depend on $(LIBRARY) without creating a forward reference 4) There also needs to be some changes so that you don't have to refer to ../../mk At present, I work round it by executing the following commands. mkdir mk (cd mk; ln -s ../../../mk/* .) ln -s ../../aclocal.m4 . ln -s ../../config.sub . ln -s ../../config.guess . ln -s ../../install-sh . cp ../../configure.in configure.in # comment out line 24 which reads: # AC_CONFIG_SUBDIRS(ghc) autoconf ./configure --with-greencard=/usr/bin/green-card -with-ghc=/usr/bin/ghc make depend make make install Note that I'm using the existing fptools configure.in file with just one line changed out of 1285 lines. This file performs far more checks than we need for most libraries but having just one file to maintain has an awful lot of advantages to counter this. Ideally, those hacky symbolic links would be made a bit more cleanly. The --with-greencard is required because it triggers configure to look for greencard and check that the version is >= 3.00. If you omit it, greencard cannot be used. (a bit ugly but I'm not sure how to do it better) I think the --with-ghc is only required because one of the makefiles refers to $(GHC) and I was too lazy to figure out whether this could be relaxed. 5) FInally, the Makefile for the library can be much the same as those in fptools/libraries except for three lines. TOP=. # not TOP=.. When using greencard we need to know where the Foreign.GreenCard.gc file was installed. The best place seems to be in the same place that Foreign.GreenCard.hi is installed. This requires this definition: GHC_INSTALL_LIBDIR=`$(TOP)/find-ghc-libdir` where find-ghc-libdir is a cunning script from the Hopengl distribution that figures out where ghc looks for installed packages. (I think there is now a cleaner way of figuring this out but can't remember it.) Also, we have to override the default libdir setting used in the install rules. Installing a library in /usr/lib is wrong - they should go in /usr/lib/ghc-5.04.2 (or wherever find-ghc-libdir reports). libdir=$(GHC_INSTALL_LIBDIR) I'd like us to come up with a better plan for how to deal with references to ghc/mk/paths.mk variables, figure out how to fix the libdir stuff, and then commit the above. Comments eagerly awaited. -- Alastair diff -c -C2 -r1.25 package.mk *** package.mk 17 May 2003 00:11:30 -0000 1.25 --- package.mk 17 May 2003 14:52:00 -0000 *************** *** 5,12 **** --- 5,53 ---- # ----------------------------------------------------------------------------- + # Building the static library libHS<pkg>.a + + ifeq "$(HC)" "" + HC = $(GHC_INPLACE) + endif + + + SRC_HSC2HS_OPTS += -I. + + ifeq "$(NON_HS_PACKAGE)" "" + SRC_HC_OPTS += -package-name $(PACKAGE) + SRC_HC_OPTS += $(GhcLibHcOpts) + SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS)) + endif + + LIBRARY = libHS$(PACKAGE)$(_way).a + + WAYS = $(GhcLibWays) + + all :: $(LIBRARY) + + # POSSIBLE alternative version using --make: + # + # lib : $(HS_SRCS) + # $(GHC_INPLACE) $(HC_OPTS) --make $(HS_SRCS) + # + # $(LIBNAME) : lib + # $(RM) $@ + # $(AR) $(AR_OPTS) $@ $(HS_OBJS) + # $(RANLIB) $@ + # + # %.o : %.hs + # $(GHC_INPLACE) $(HC_OPTS) --make $< + # %.o : %.lhs + # $(GHC_INPLACE) $(HC_OPTS) --make $< + + # ----------------------------------------------------------------------------- # Build the package configuration file and tell the compiler about it. ifeq "$(way)" "" + ifeq "$(GHC_INCLUDE_DIR)" "" + GHC_INCLUDE_DIR=. + endif + package.conf.inplace : package.conf.in $(CPP) $(RAWCPP_FLAGS) -I$(GHC_INCLUDE_DIR) -x c $(PACKAGE_CPP_OPTS) $< \ *************** *** 28,41 **** # will be correctly re-installed. # STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE) CLEAN_FILES += $(STAMP_PKG_CONF) ifneq "$(BootingFromHc)" "YES" ! boot all :: $(STAMP_PKG_CONF) endif ! $(STAMP_PKG_CONF) : package.conf.inplace package.conf.installed $(GHC_PKG_INPLACE) --update-package <package.conf.inplace ! $(GHC_PKG_INPLACE) -f $(GHC_DRIVER_DIR)/package.conf --update-package <package.conf.installed @touch $(STAMP_PKG_CONF) --- 69,96 ---- # will be correctly re-installed. # + + ifeq "$(GHC_DRIVER_DIR)" "" + STAMP_PKG_CONF = $(TOP)/stamp-pkg-conf-$(PACKAGE) + else STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE) + endif + CLEAN_FILES += $(STAMP_PKG_CONF) ifneq "$(BootingFromHc)" "YES" ! install :: $(STAMP_PKG_CONF) ! endif ! ! ifeq "$(GHC_PKG_INPLACE)" "" ! GHC_PKG_INPLACE=$(GHC_PKG) ! endif ! ! ifeq "$(GHC_INSTALL_LIBDIR)" "" ! GHC_INSTALL_LIBDIR=$(GHC_DRIVER_DIR) endif ! $(STAMP_PKG_CONF) : package.conf.inplace package.conf.installed $(LIBRARY) $(GHC_PKG_INPLACE) --update-package <package.conf.inplace ! $(GHC_PKG_INPLACE) -f $(GHC_INSTALL_LIBDIR)/package.conf --update-package <package.conf.installed @touch $(STAMP_PKG_CONF) *************** *** 45,82 **** # ----------------------------------------------------------------------------- - # Building the static library libHS<pkg>.a - - HC = $(GHC_INPLACE) - - SRC_HSC2HS_OPTS += -I. - - ifeq "$(NON_HS_PACKAGE)" "" - SRC_HC_OPTS += -package-name $(PACKAGE) - SRC_HC_OPTS += $(GhcLibHcOpts) - SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS)) - endif - - LIBRARY = libHS$(PACKAGE)$(_way).a - - WAYS = $(GhcLibWays) - - all :: $(LIBRARY) - - # POSSIBLE alternative version using --make: - # - # lib : $(HS_SRCS) - # $(GHC_INPLACE) $(HC_OPTS) --make $(HS_SRCS) - # - # $(LIBNAME) : lib - # $(RM) $@ - # $(AR) $(AR_OPTS) $@ $(HS_OBJS) - # $(RANLIB) $@ - # - # %.o : %.hs - # $(GHC_INPLACE) $(HC_OPTS) --make $< - # %.o : %.lhs - # $(GHC_INPLACE) $(HC_OPTS) --make $< - - # ----------------------------------------------------------------------------- # Installation; need to install .hi files as well as libraries --- 100,103 ---- *************** *** 112,117 **** # Dependencies ! MKDEPENDHS = $(GHC_INPLACE) ! SRC_MKDEPENDC_OPTS += $(addprefix -I,$(ALL_DIRS)) -I$(GHC_INCLUDE_DIR) endif # $(PACKAGE) /= "" --- 133,138 ---- # Dependencies ! MKDEPENDHS = $(GHC) ! SRC_MKDEPENDC_OPTS += $(addprefix -I,$(ALL_DIRS)) -I$(TOP_DIR) endif # $(PACKAGE) /= ""
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: ghc-pkg and -l, Axel Simon |
|---|---|
| Next by Date: | Re: Changes to make fptools insfrastructure usable for standalone libraries, Ross Paterson |
| Previous by Thread: | [ ghc-Bugs-738883 ] PosixTTY's testLocalFlag has c_iflags instead of c_lflags, SourceForge.net |
| Next by Thread: | Re: Changes to make fptools insfrastructure usable for standalone libraries, Ross Paterson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |