From e85ec8a2c2c18ca42c1d55670936db21a1cd52c9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 14 Aug 2009 22:00:32 +0000 Subject: [PATCH] 2009-08-14 23:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL + Separated instructions for linux/darwin and rest of *nixes. The only difference is that the latter needs 'gmake' command to start. + MSYS/Cygwin section extended a bit. (It's now possible to build for any compilers from MSYS/Cygwin) * make_gnu.sh % Deleted unused HB_ARCH64 variable. * config/global.cf - Deleted svnversion trick since it's not guaranteed this command is present on builder's system. + Added doc links from make_gnu.sh. (deleted from there) * Changed to default HB_INSTALL_PREFIX to /usr/local on *nix systems. I very much don't like this (even though I understand why it's done that way). + Added {HB_TOP} macro for HB_INSTALL_PREFIX, so if someone wants to install Harbour in its own dir, it enough to do: export/set HB_INSTALL_PREFIX={HB_TOP}. This is crucial if someone doesn't want to "pollute" system areas with Harbour builds, doesn't want to use admin rights to make the install, or if someone wants to use multiple Harbour builds in parallel for any reason. hbmk2 works perfectly without Harbour being installed to system location. + Whenever HB_INSTALL_PREFIX is modified by GNU Make (defaulting or macro replacement), the new value will be presented for the user. % Minor optimization. * Minor cleanups to pkg dir assembling logic. * config/linux/global.cf + Added -fPIC detection logic. This is just a start, it doesn't replicate full logic found in make_gnu.sh. Przemek, if you have some spare time, please look into it. --- harbour/ChangeLog | 37 +++++++++++ harbour/INSTALL | 27 +++++++-- harbour/config/global.cf | 108 ++++++++++++++++++--------------- harbour/config/linux/global.cf | 12 ++++ harbour/make_gnu.sh | 8 --- 5 files changed, 131 insertions(+), 61 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fadeb7352d..70b829d0a0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,43 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-14 23:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * INSTALL + + Separated instructions for linux/darwin and rest of *nixes. + The only difference is that the latter needs 'gmake' command + to start. + + MSYS/Cygwin section extended a bit. (It's now possible to + build for any compilers from MSYS/Cygwin) + + * make_gnu.sh + % Deleted unused HB_ARCH64 variable. + + * config/global.cf + - Deleted svnversion trick since it's not guaranteed this + command is present on builder's system. + + Added doc links from make_gnu.sh. (deleted from there) + * Changed to default HB_INSTALL_PREFIX to /usr/local on + *nix systems. I very much don't like this (even though I + understand why it's done that way). + + Added {HB_TOP} macro for HB_INSTALL_PREFIX, so if someone + wants to install Harbour in its own dir, it enough to do: + export/set HB_INSTALL_PREFIX={HB_TOP}. + This is crucial if someone doesn't want to "pollute" system + areas with Harbour builds, doesn't want to use admin rights + to make the install, or if someone wants to use multiple + Harbour builds in parallel for any reason. hbmk2 works + perfectly without Harbour being installed to system location. + + Whenever HB_INSTALL_PREFIX is modified by GNU Make (defaulting + or macro replacement), the new value will be presented for the + user. + % Minor optimization. + * Minor cleanups to pkg dir assembling logic. + + * config/linux/global.cf + + Added -fPIC detection logic. This is just a start, it doesn't + replicate full logic found in make_gnu.sh. Przemek, if you have + some spare time, please look into it. + 2009-08-14 22:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/pp/Makefile ! Fixed to not throw harmless but still confusing error diff --git a/harbour/INSTALL b/harbour/INSTALL index f8c18d7336..1b70e91c80 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -25,8 +25,8 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE * GNU Make (3.81 or upper) * Harbour sources (2.0.0 or upper) - Linux/Darwin/BSD/HP-UX/Solaris - ------------------------------ + Linux/Darwin + ------------ [ $ export HB_COMPILER= ] [ $ export HB_INSTALL_PREFIX= ] $ make install @@ -37,6 +37,18 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE $ ./hello You should see 'Hello world!' on screen. + BSD/HP-UX/Solaris + ----------------- + [ $ export HB_COMPILER= ] + [ $ export HB_INSTALL_PREFIX= ] + $ gmake install + + To test it, type: + $ cd bin + $ ./hbmk2 ../tests/hello.prg + $ ./hello + You should see 'Hello world!' on screen. + NOTE for sunpro on Solaris: --------------------------- If you have any GNU binutils stuff installed, do make sure @@ -80,10 +92,12 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE - You can also use Linux hosts to create Windows CE builds. See script: make_gnu_xmingwce.sh - Windows with MinGW + MSYS or Cygwin - ---------------------------------------------- - You can also use bash shell to build for these platforms. + Windows with MSYS or Cygwin shells + ---------------------------------- + You can also use these shells to build Harbour on Windows. + Generally it's recommended to use native shell though. + [ > set HB_COMPILER=<...> ] [ > set HB_INSTALL_PREFIX= ] > sh -c make install @@ -95,6 +109,9 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE NOTES: - With cygwin, should use Cygwin drive notation: /cygdrive/c for C: + - When building for Borland C make sure that + GNU Make is executed when typing 'make', + Borland Make has the same name. MS-DOS ------ diff --git a/harbour/config/global.cf b/harbour/config/global.cf index 6f5c0793bd..cb7328b301 100644 --- a/harbour/config/global.cf +++ b/harbour/config/global.cf @@ -14,6 +14,8 @@ # http://lists.gnu.org/archive/html/help-make/ # Portable shell programming: # http://www.gnu.org/software/autoconf/manual/html_node/Portable-Shell.html +# http://www.gnu.org/software/bash/manual/bashref.html +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html # GNU Coding standards: # http://www.gnu.org/prep/standards/standards.html # --------------------------------------------------------------- @@ -170,34 +172,34 @@ ifneq ($(HB_BUILD_NAME),) endif endif -ifeq ($(HB_CONFIG_SHOWN),) +ifeq ($(HB_INIT_DONE),) # Store the original value export HB_MAKECMDGOALS := $(MAKECMDGOALS) -endif -ifeq ($(HB_BUILD_PKG),yes) + ifeq ($(HB_BUILD_PKG),yes) - # 'clean' and 'install' are required when building a release package - ifeq ($(findstring clean,$(HB_MAKECMDGOALS)),) - export HB_BUILD_PKG := no - else - ifeq ($(findstring install,$(HB_MAKECMDGOALS)),) + # 'clean' and 'install' are required when building a release package + ifeq ($(findstring clean,$(HB_MAKECMDGOALS)),) export HB_BUILD_PKG := no + else + ifeq ($(findstring install,$(HB_MAKECMDGOALS)),) + export HB_BUILD_PKG := no + endif endif - endif - ifeq ($(HB_BUILD_PKG),no) - $(warning ! Warning: You have to use 'clean install' to create a release package.) - endif + ifeq ($(HB_BUILD_PKG),no) + $(warning ! Warning: You have to use 'clean install' to create a release package.) + endif - # Enforce some basic setting for release packages - export HB_BUILD_DLL := yes - export HB_BUILD_IMPLIB := no - export HB_BUILD_OPTIM := yes - export HB_BUILD_DEBUG := no + # Enforce some basic setting for release packages + export HB_BUILD_DLL := yes + export HB_BUILD_IMPLIB := no + export HB_BUILD_OPTIM := yes + export HB_BUILD_DEBUG := no + endif endif -ifeq ($(HB_CONFIG_SHOWN),) +ifeq ($(HB_INIT_DONE),) ifneq ($(MAKE_381),) # Some additional ones to be given a standard name: @@ -223,9 +225,6 @@ ifeq ($(HB_CONFIG_SHOWN),) # -DHB_PCRE_REGEX, -DHB_POSIX_REGEX, -DHB_EXT_ZLIB, -DHB_HAS_GPM $(info ! MAKE: $(MAKE) $(MAKE_VERSION) $(HB_MAKECMDGOALS) $(SHELL)) - ifeq ($(HB_BUILD_VERBOSE),yes) - $(info ! SVN: $(shell svnversion)) - endif ifneq ($(HB_USER_PRGFLAGS),) $(info ! HB_USER_PRGFLAGS: $(HB_USER_PRGFLAGS)) endif @@ -385,7 +384,7 @@ ifeq ($(HB_HOST_ARCH),) endif endif -ifeq ($(HB_CONFIG_SHOWN),) +ifeq ($(HB_INIT_DONE),) ifneq ($(MAKE_381),) $(info ! HB_HOST_ARCH: $(HB_HOST_ARCH) HB_SHELL: $(HB_SHELL)) endif @@ -582,7 +581,7 @@ ifeq ($(HB_COMPILER),) $(error ! HB_COMPILER not set, couldn't autodetect.) endif -ifeq ($(HB_CONFIG_SHOWN),) +ifeq ($(HB_INIT_DONE),) ifneq ($(MAKE_381),) $(info ! HB_ARCHITECTURE: $(HB_ARCHITECTURE) $(HB_ARCH_AUTO)) $(info ! HB_COMPILER: $(HB_COMPILER) $(HB_COMP_AUTO)) @@ -810,23 +809,32 @@ export HB_VERSION export HB_PKGNAME export HB_PKGNAMI +HB_INSTALL_PREFIX_ORI := $(HB_INSTALL_PREFIX) ifeq ($(HB_BUILD_PKG),yes) - PKG_DIR := $(subst /,$(DIRSEP),$(TOP)$(ROOT))pkg - export HB_PKGBASE := $(PKG_DIR)$(DIRSEP)$(HB_ARCHITECTURE)$(DIRSEP)$(HB_COMPILER) - export HB_PKGPATH := $(subst /,$(DIRSEP),$(abspath $(PKG_DIR)$(DIRSEP)$(HB_PKGNAME))) - HB_INSTALL_PREFIX := $(subst /,$(DIRSEP),$(abspath $(HB_PKGBASE)$(DIRSEP)$(HB_PKGNAME))) + ifeq ($(HB_INIT_DONE),) + PKG_DIR := $(TOP)$(ROOT)pkg + export HB_PKGBASE := $(subst /,$(DIRSEP),$(PKG_DIR)/$(HB_ARCHITECTURE)/$(HB_COMPILER)) + export HB_PKGPATH := $(subst /,$(DIRSEP),$(abspath $(PKG_DIR)/$(HB_PKGNAME))) + HB_INSTALL_PREFIX := $(subst /,$(DIRSEP),$(abspath $(HB_PKGBASE)/$(HB_PKGNAME))) + PKG_DIR := $(subst /,$(DIRSEP),$(PKG_DIR)) - .PHONY: clean - - HB_BIN_INSTALL := - HB_INC_INSTALL := - HB_LIB_INSTALL := - HB_DOC_INSTALL := + HB_BIN_INSTALL := + HB_INC_INSTALL := + HB_LIB_INSTALL := + HB_DOC_INSTALL := + endif else # Fill it automatically if not specified ifeq ($(HB_INSTALL_PREFIX),) - HB_INSTALL_PREFIX := $(subst /,$(DIRSEP),$(realpath $(TOP)$(ROOT))) + ifeq ($(HB_UNIX_COMPATIBLE),no) + HB_INSTALL_PREFIX := $(realpath $(TOP)$(ROOT)) + else + # Stick to *nix customs. I don't like it, it needs admin. + HB_INSTALL_PREFIX := /usr/local + endif + + HB_INSTALL_PREFIX := $(subst /,$(DIRSEP),$(HB_INSTALL_PREFIX)) # Use names which are not likely to be used by users to # avoiding accidental overwrites of existing installations @@ -839,23 +847,29 @@ else # HB_INSTALL_PREFIX := $(HOME)$(DIRSEP)hb-auto-$(HB_ARCHITECTURE)-$(HB_COMPILER) # endif # endif + else + # TOFIX: HB_INSTALL_PREFIX will have to be duplicated internally to avoid + # recursive operation here. - ifneq ($(MAKE_381),) - $(info ! HB_INSTALL_PREFIX automatically set to $(HB_INSTALL_PREFIX)) - endif + # Handle simple macros in value + HB_INSTALL_PREFIX := $(subst {HB_ARCH},$(HB_ARCHITECTURE),$(HB_INSTALL_PREFIX)) + HB_INSTALL_PREFIX := $(subst {HB_COMP},$(HB_COMPILER),$(HB_INSTALL_PREFIX)) + HB_INSTALL_PREFIX := $(subst {HB_CPU},$(HB_CPU),$(HB_INSTALL_PREFIX)) + HB_INSTALL_PREFIX := $(subst {HB_TOP},$(realpath $(TOP)$(ROOT)),$(HB_INSTALL_PREFIX)) + HB_INSTALL_PREFIX := $(subst /,$(DIRSEP),$(HB_INSTALL_PREFIX)) + endif +endif + +export HB_INSTALL_PREFIX + +ifneq ($(HB_INSTALL_PREFIX_ORI),$(HB_INSTALL_PREFIX)) + ifneq ($(MAKE_381),) + $(info ! HB_INSTALL_PREFIX set to $(HB_INSTALL_PREFIX)) endif endif ifneq ($(HB_INSTALL_PREFIX),) - # TOFIX: HB_INSTALL_PREFIX will have to be duplicated internally to avoid - # recursive operation here. - - # Handle simple macros in value - HB_INSTALL_PREFIX := $(subst {HB_ARCH},$(HB_ARCHITECTURE),$(HB_INSTALL_PREFIX)) - HB_INSTALL_PREFIX := $(subst {HB_COMP},$(HB_COMPILER),$(HB_INSTALL_PREFIX)) - HB_INSTALL_PREFIX := $(subst {HB_CPU},$(HB_CPU),$(HB_INSTALL_PREFIX)) - ifeq ($(HB_UNIX_COMPATIBLE),no) LIBPOSTFIX := $(DIRSEP)$(subst /,$(DIRSEP),$(ARCH_COMP)) else @@ -886,8 +900,6 @@ ifneq ($(HB_INSTALL_PREFIX),) endif endif -export HB_INSTALL_PREFIX - export HB_OBJ_DIR := $(subst /,$(DIRSEP),$(OBJ_DIR)) ifeq ($(HB_BIN_COMPILE),) @@ -918,7 +930,7 @@ ifeq ($(findstring -w,$(HB_USER_MAKEFLAGS))$(findstring --print-directory,$(HB_U MKFLAGS := --no-print-directory endif -export HB_CONFIG_SHOWN := yes +export HB_INIT_DONE := yes include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf include $(TOP)$(ROOT)config/globsh.cf diff --git a/harbour/config/linux/global.cf b/harbour/config/linux/global.cf index 89c2250574..39da37bb48 100644 --- a/harbour/config/linux/global.cf +++ b/harbour/config/linux/global.cf @@ -7,3 +7,15 @@ all : first BIN_EXT := HB_GT_LIBS += gttrm + +ifeq ($(HB_SHELL),sh) + ifneq ($(HB_COMPILER),sunpro) + ifeq ($(findstring -fPIC,$(HB_USER_CFLAGS)),) + _UNAME_M := $(shell uname -m) + # TODO: Make this complete + ifneq ($(findstring $(_UNAME_M),@64 _64),) + HB_USER_CFLAGS += -fPIC + endif + endif + endif +endif diff --git a/harbour/make_gnu.sh b/harbour/make_gnu.sh index 875109f961..d7fd4b370f 100755 --- a/harbour/make_gnu.sh +++ b/harbour/make_gnu.sh @@ -13,13 +13,6 @@ # Please read INSTALL for further information. # --------------------------------------------------------------- -# --------------------------------------------------------------- -# See GNU bash docs here: -# http://www.gnu.org/software/bash/manual/bashref.html -# See POSIX shell docs here: -# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html -# --------------------------------------------------------------- - if [ -z "$HB_ARCHITECTURE" ]; then if [ "$OSTYPE" = "msdosdjgpp" ]; then hb_arch="dos" @@ -70,7 +63,6 @@ then case "$HB_CPU" in *[@_]64) export HB_USER_CFLAGS="$HB_USER_CFLAGS -fPIC" - HB_ARCH64="yes" ;; *[ix]*86) ;;