2010-08-07 11:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/make.hbs
    + Generalized the way dynamic lib dependencies are found 
      to make it work on *nix systems, too.

  * include/harbour.hbx
  + src/rtl/libnamec.c
  * src/rtl/libname.prg
  * src/rtl/Makefile
    + Added HB_LIBEXT() and HB_LIBPREFIX() functions.

  * utils/hbmk2/hbmk2.prg
    + Added "platform", "compiler", "cpu", "buildname", "dynsuffix" 
      to --hbinfo returned data.

  * INSTALL
    + Documented HB_BUILD_CONTRIB_DYN setting. The default is
      'no', and if set to 'yes', the build system will create
      dynamic lib versions of the contribs.

  * src/Makefile
  * utils/hbformat/Makefile
  * utils/hbi18n/Makefile
  * utils/hbtest/Makefile
  * config/global.mk
  * config/dos/watcom.mk
  * config/dos/djgpp.mk
  * config/dyn.mk
  * config/rules.mk
  * INSTALL
    * Renamed HB_BUILD_DLL to HB_BUILD_DYN.
This commit is contained in:
Viktor Szakats
2010-08-07 10:00:21 +00:00
parent 742e4407ee
commit 5a6facdcc2
17 changed files with 168 additions and 53 deletions

View File

@@ -16,6 +16,38 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-08-07 11:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/make.hbs
+ Generalized the way dynamic lib dependencies are found
to make it work on *nix systems, too.
* include/harbour.hbx
+ src/rtl/libnamec.c
* src/rtl/libname.prg
* src/rtl/Makefile
+ Added HB_LIBEXT() and HB_LIBPREFIX() functions.
* utils/hbmk2/hbmk2.prg
+ Added "platform", "compiler", "cpu", "buildname", "dynsuffix"
to --hbinfo returned data.
* INSTALL
+ Documented HB_BUILD_CONTRIB_DYN setting. The default is
'no', and if set to 'yes', the build system will create
dynamic lib versions of the contribs.
* src/Makefile
* utils/hbformat/Makefile
* utils/hbi18n/Makefile
* utils/hbtest/Makefile
* config/global.mk
* config/dos/watcom.mk
* config/dos/djgpp.mk
* config/dyn.mk
* config/rules.mk
* INSTALL
* Renamed HB_BUILD_DLL to HB_BUILD_DYN.
2010-08-07 11:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtcore/hbqt.h
* contrib/hbqt/utils/hbqtgen.prg

View File

@@ -658,7 +658,8 @@ HARBOUR
apply. It's valid to use (back)slashes though.
- HB_BUILD_PKG=yes Create release package. Default: no
Requires 'clean install' in root source dir.
- HB_BUILD_DLL=no Create Harbour dynamic libraries. Default: yes
- HB_BUILD_DYN=no Create Harbour dynamic libraries. Default: yes
- HB_BUILD_CONTRIB_DYN=yes Create dynamic libraries for contribs. Default: no
- HB_BUILD_SHARED=yes Create Harbour executables in shared mode.
Default: yes when HB_INSTALL_PREFIX points
to a *nix system location, otherwise no.

View File

@@ -108,7 +108,7 @@ AR_RULE = $(create_library)
LD_RULE = $(link_exe_file)
ifeq ($(HB_BUILD_DLL),dostest)
ifeq ($(HB_BUILD_DYN),dostest)
DY := dxe3gen
DFLAGS += $(LIBPATHS)
@@ -136,6 +136,6 @@ ifeq ($(HB_BUILD_DLL),dostest)
DY_RULE = $(create_dynlib)
endif # HB_BUILD_DLL
endif # HB_BUILD_DYN
include $(TOP)$(ROOT)config/rules.mk

View File

@@ -71,7 +71,7 @@ ifneq ($(HB_LINKING_RTL),)
endif
endif
ifeq ($(HB_BUILD_DLL),dostest)
ifeq ($(HB_BUILD_DYN),dostest)
DY := $(LD)
DFLAGS += OP quiet SYS cwdllr
@@ -101,6 +101,6 @@ ifeq ($(HB_BUILD_DLL),dostest)
DY_RULE = $(create_dynlib)
endif # HB_BUILD_DLL
endif # HB_BUILD_DYN
include $(TOP)$(ROOT)config/common/watcom.mk

View File

@@ -80,7 +80,7 @@ endif
DYN_FILE :=
IMP_FILE :=
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
ifneq ($(DY_RULE),)
DYN_NAME := $(DYN_PREF)$(DYNNAME)$(DYN_EXT)

View File

@@ -176,7 +176,7 @@ ifeq ($(HB_INIT_DONE),)
endif
# Enforce some basic settings for release packages
export HB_BUILD_DLL := yes
export HB_BUILD_DYN := yes
export HB_BUILD_OPTIM := yes
export HB_BUILD_DEBUG := no
export HB_BUILD_SHARED := no
@@ -186,7 +186,7 @@ ifeq ($(HB_INIT_DONE),)
endif
# Can't build shared tools if we don't create dlls
ifeq ($(HB_BUILD_DLL),no)
ifeq ($(HB_BUILD_DYN),no)
export HB_BUILD_SHARED := no
endif
@@ -272,8 +272,8 @@ ifeq ($(HB_INIT_DONE),)
ifneq ($(HB_BUILD_PKG),)
$(info ! HB_BUILD_PKG: $(HB_BUILD_PKG))
endif
ifneq ($(HB_BUILD_DLL),)
$(info ! HB_BUILD_DLL: $(HB_BUILD_DLL))
ifneq ($(HB_BUILD_DYN),)
$(info ! HB_BUILD_DYN: $(HB_BUILD_DYN))
endif
ifneq ($(HB_BUILD_SHARED),)
$(info ! HB_BUILD_SHARED: $(HB_BUILD_SHARED))
@@ -1707,7 +1707,7 @@ ifeq ($(HB_HOST_INC),)
endif
ifeq ($(HB_INIT_DONE),)
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
ifeq ($(HB_PLATFORM_UNIX),)
HB_DYN_VER := $(HB_VER_MAJOR)$(HB_VER_MINOR)

View File

@@ -41,7 +41,7 @@ CC_FLAGS := $(HB_INC_DEPEND) $(CFLAGS) $(HB_CFLAGS)
# The rule to compile a C source file.
ifeq ($(CC_RULE),)
CC_RULE = $(CC) $(subst $(CC_DIRSEPFROM),$(CC_DIRSEPTO),$(CC_FLAGS) $(HB_USER_CFLAGS) $(CC_OUT)$(<F:.c=$(OBJ_EXT)) $(HB_CFLAGS_STA) $(CC_IN) $<)
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
ifneq ($(HB_DYN_COPT),)
ifneq ($(LIBNAME),)
ifneq ($(filter $(LIBNAME),$(HB_DYN_LIBS)),)

View File

@@ -337,7 +337,7 @@ PROCEDURE GNUMake( aParams, hProjectList )
hb_setenv( "_HB_INSTALL_MAN", GetEnv( "HB_INSTALL_MAN" ) )
hb_setenv( "_HB_INSTALL_ETC", GetEnv( "HB_INSTALL_ETC" ) )
/* Override hbmk2 autodetection */
/* Override hbmk2 autodetection. WARNING: Must be in sync with global.mk logic */
hb_setenv( "HB_INSTALL_PREFIX", s_cRoot )
hb_setenv( "HB_INSTALL_BIN", s_cRoot + "bin/" + GetEnv( "HB_PLATFORM" ) + "/" + GetEnv( "HB_COMPILER" ) + GetEnv( "HB_BUILD_NAME" ) )
hb_setenv( "HB_INSTALL_LIB", s_cRoot + "lib/" + GetEnv( "HB_PLATFORM" ) + "/" + GetEnv( "HB_COMPILER" ) + GetEnv( "HB_BUILD_NAME" ) )
@@ -365,6 +365,8 @@ STATIC PROCEDURE build_projects( nAction, hProjectList, hProjectReqList, cOption
LOCAL cProjectPath
LOCAL lPrimary
LOCAL cDynSuffix
/* Preprocessing */
IF Len( hProjectReqList ) > 1
@@ -426,11 +428,21 @@ STATIC PROCEDURE build_projects( nAction, hProjectList, hProjectReqList, cOption
cProjectPath := s_cBase + s_cHome + cProject
lPrimary := cProject $ hProjectReqList .OR. "lFromContainer" $ hProjectList[ cProject ]
IF call_hbmk2( cProjectPath, iif( lPrimary, cOptions + cOptionsUser, " -inc" ), .F. )
IF call_hbmk2( cProjectPath, iif( lPrimary, cOptions + cOptionsUser, " -inc" ), NIL )
/* Build dynamic lib */
IF GetEnv( "HB_BUILD_CONTRIB_DYN" ) == "yes" .AND. hProjectList[ cProject ][ "cType" ] == "hblib"
call_hbmk2( cProjectPath, iif( lPrimary, cOptions + cOptionsUser, " -inc" ), .T. )
/* Is this a platform where import libs are used? */
IF "|" + hProjectList[ cProject ][ "cPlatform" ] + "|" $ "|win|dos|os2|"
IF Empty( hProjectList[ cProject ][ "cDynSuffix" ] )
cDynSuffix := "_dll"
ELSE
cDynSuffix := hProjectList[ cProject ][ "cDynSuffix" ]
ENDIF
ELSE
cDynSuffix := hb_libExt()
ENDIF
call_hbmk2( cProjectPath, iif( lPrimary, cOptions + cOptionsUser, " -inc" ), cDynSuffix )
ENDIF
/* Compile documentation */
@@ -459,10 +471,12 @@ STATIC FUNCTION call_hbmk2_hbinfo( cProjectPath, hProject )
hProject[ "aDept" ] := {}
hProject[ "lChecked" ] := NIL
IF call_hbmk2( cProjectPath, " --hbinfo", .F.,, @cStdOut )
IF call_hbmk2( cProjectPath, " --hbinfo", NIL,, @cStdOut )
hProject[ "cType" ] := hbmk2_hbinfo_getitem( cStdOut, "targettype" )
hProject[ "cOutputName" ] := hbmk2_hbinfo_getitem( cStdOut, "outputname" )
hProject[ "cDynSuffix" ] := hbmk2_hbinfo_getitem( cStdOut, "dynsuffix" )
hProject[ "cPlatform" ] := hbmk2_hbinfo_getitem( cStdOut, "platform" )
FOR EACH tmp IN hb_ATokens( hbmk2_hbinfo_getitem( cStdOut, "hbctree", .T. ), Chr( 10 ) )
IF ! Empty( tmp )
@@ -497,7 +511,7 @@ STATIC FUNCTION hbmk2_hbinfo_getitem( cString, cItem, lAll )
RETURN cRetVal
STATIC FUNCTION call_hbmk2( cProjectPath, cOptionsPre, lLibDyn, cStdErr, cStdOut )
STATIC FUNCTION call_hbmk2( cProjectPath, cOptionsPre, cDynSuffix, cStdErr, cStdOut )
LOCAL nErrorLevel
LOCAL cOptionsLibDyn := ""
LOCAL cCommand
@@ -509,8 +523,8 @@ STATIC FUNCTION call_hbmk2( cProjectPath, cOptionsPre, lLibDyn, cStdErr, cStdOut
hb_setenv( "CLIPPER" )
hb_setenv( "CLIPPERCMD" )
IF lLibDyn
hb_setenv( "__HB_DYN__", "_dll" ) /* Request dll version of Harbour contrib dependencies (the implibs) to be linked (experimental) */
IF cDynSuffix != NIL
hb_setenv( "__HB_DYN__", cDynSuffix ) /* Request dll version of Harbour contrib dependencies (the implibs) to be linked (experimental) */
hb_setenv( "_HB_BUILD_LIBDYN", "yes" )
IF hb_FileExists( FNameExtSet( cProjectPath, ".hbc" ) )

View File

@@ -605,10 +605,12 @@ DYNAMIC HB_LANGMESSAGE
DYNAMIC HB_LANGNAME
DYNAMIC HB_LANGSELECT
DYNAMIC HB_LIBERROR
DYNAMIC HB_LIBEXT
DYNAMIC HB_LIBFREE
DYNAMIC HB_LIBGETFUNSYM
DYNAMIC HB_LIBLOAD
DYNAMIC HB_LIBNAME
DYNAMIC HB_LIBPREFIX
DYNAMIC HB_MACROBLOCK
DYNAMIC HB_MATHERBLOCK
DYNAMIC HB_MATHERMODE

View File

@@ -17,7 +17,7 @@ ifeq ($(HB_BUILD_PARTS),compiler)
else
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
DYNDIRLIST_BASE := \
src/common \
@@ -97,7 +97,7 @@ else
hbextern$(HB_COMP_REF) \
debug$(HB_COMP_REF)
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
DIRS += dynlib{codepage,common,hbextern,lang,macro,pp,rdd,rtl,vm}
endif

View File

@@ -118,6 +118,7 @@ C_SOURCES := \
left.c \
len.c \
lennum.c \
libnamec.c \
math.c \
maxrow.c \
memofile.c \

View File

@@ -53,42 +53,18 @@
FUNCTION hb_LibName( cLibName, cLibDir )
LOCAL cDir, cName, cExt
LOCAL cLibPrefix
LOCAL cLibExt
IF hb_isString( cLibName )
#if defined( __PLATFORM__WINDOWS ) .OR. ;
defined( __PLATFORM__OS2 ) .OR. ;
defined( __PLATFORM__SYMBIAN )
cLibExt := ".dll"
#elif defined( __PLATFORM__DOS )
cLibExt := ""
#elif defined( __PLATFORM__DARWIN )
cLibExt := ".dylib"
#elif defined( __PLATFORM__HPUX )
cLibExt := ".sl"
#else
cLibExt := ".so"
#endif
#if ! defined( __PLATFORM__UNIX ) .OR. ;
defined( __PLATFORM__SYMBIAN )
cLibPrefix := ""
#else
cLibPrefix := "lib"
#endif
hb_FNameSplit( cLibName, @cDir, @cName, @cExt )
IF Empty( cDir ) .AND. hb_isString( cLibDir )
cDir := cLibDir
ENDIF
IF Empty( cExt )
cExt := cLibExt
cExt := hb_libExt()
ENDIF
RETURN hb_FNameMerge( cDir, cLibPrefix + cName, cExt )
RETURN hb_FNameMerge( cDir, hb_libPrefix() + cName, cExt )
ENDIF
RETURN ""

View File

@@ -0,0 +1,82 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* HB_LIBEXT(), HB_LIBPREFIX()
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* www - http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
HB_FUNC( HB_LIBEXT )
{
#if defined( HB_OS_WIN ) || defined( HB_OS_OS2 ) || defined( HB_OS_SYMBIAN )
hb_retc_const( ".dll" );
#elif defined( HB_OS_DOS )
hb_retc_null();
#elif defined( HB_OS_DARWIN )
hb_retc_const( ".dylib" );
#elif defined( HB_OS_HPUX )
hb_retc_const( ".sl" );
#else
hb_retc_const( ".so" );
#endif
}
HB_FUNC( HB_LIBPREFIX )
{
#if ! defined( HB_OS_UNIX ) || defined( HB_OS_SYMBIAN )
hb_retc_null();
#else
hb_retc_const( "lib" );
#endif
}

View File

@@ -15,7 +15,7 @@ PRG_MAIN := hbformat.prg
LIBS = $(HB_LIBS_ST_NORDD)
ifneq ($(filter $(HB_PLATFORM),win wce os2),)
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
HB_BUILD_SHARED := yes
endif
endif

View File

@@ -12,7 +12,7 @@ PRG_MAIN := hbi18n.prg
LIBS = $(HB_LIBS_ST_NORDD)
ifneq ($(filter $(HB_PLATFORM),win wce os2),)
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
HB_BUILD_SHARED := yes
endif
endif

View File

@@ -854,6 +854,8 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
s_cSecToken := StrZero( hb_Random( 1, 4294967294 ), 10, 0 )
ENDIF
hbmk[ _HBMK_cBUILD ] := ""
hbmk[ _HBMK_lStopAfterInit ] := .F.
hbmk[ _HBMK_lStopAfterHarbour ] := .F.
@@ -1537,7 +1539,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
hb_DirExists( PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) ) + "lib" +;
hb_ps() + hbmk[ _HBMK_cPLAT ] +;
hb_ps() + aCOMPDET[ tmp ][ _COMPDET_cCOMP ] +;
iif( Empty( hbmk[ _HBMK_cBUILD ] ), "", PathSepToSelf( hbmk[ _HBMK_cBUILD ] ) ) )
PathSepToSelf( hbmk[ _HBMK_cBUILD ] ) )
hbmk[ _HBMK_cCOMP ] := aCOMPDET[ tmp ][ _COMPDET_cCOMP ]
IF Len( aCOMPDET[ tmp ] ) >= _COMPDET_cCCPREFIX
hbmk[ _HBMK_cCCPREFIX ] := aCOMPDET[ tmp ][ _COMPDET_cCCPREFIX ]
@@ -1725,7 +1727,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
IF hb_DirExists( tmp := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) ) + "bin" +;
hb_ps() + hbmk[ _HBMK_cPLAT ] +;
hb_ps() + hbmk[ _HBMK_cCOMP ] +;
iif( Empty( hbmk[ _HBMK_cBUILD ] ), "", PathSepToSelf( hbmk[ _HBMK_cBUILD ] ) ) )
PathSepToSelf( hbmk[ _HBMK_cBUILD ] ) )
l_cHB_INSTALL_BIN := tmp
ELSE
l_cHB_INSTALL_BIN := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + "bin" )
@@ -1736,7 +1738,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
IF hb_DirExists( tmp := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) ) + "lib" +;
hb_ps() + hbmk[ _HBMK_cPLAT ] +;
hb_ps() + hbmk[ _HBMK_cCOMP ] +;
iif( Empty( hbmk[ _HBMK_cBUILD ] ), "", PathSepToSelf( hbmk[ _HBMK_cBUILD ] ) ) )
PathSepToSelf( hbmk[ _HBMK_cBUILD ] ) )
l_cHB_INSTALL_LIB := tmp
ELSE
l_cHB_INSTALL_LIB := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + "lib" )
@@ -4598,11 +4600,16 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
IF lDumpInfo
OutStd( "{{{" + hb_eol() )
OutStd( "platform{{" + hbmk[ _HBMK_cPLAT ] + "}}" + hb_eol() )
OutStd( "compiler{{" + hbmk[ _HBMK_cCOMP ] + "}}" + hb_eol() )
OutStd( "cpu{{" + hbmk[ _HBMK_cCPU ] + "}}" + hb_eol() )
OutStd( "buildname{{" + hbmk[ _HBMK_cBUILD ] + "}}" + hb_eol() )
IF ! Empty( hbmk[ _HBMK_cPROGNAME ] )
OutStd( "outputname{{" + PathSepToForward( hbmk[ _HBMK_cPROGNAME ] ) + "}}" + hb_eol() )
ENDIF
OutStd( "targetname{{" + hbmk_TARGETNAME( hbmk ) + "}}" + hb_eol() )
OutStd( "targettype{{" + hbmk_TARGETTYPE( hbmk ) + "}}" + hb_eol() )
OutStd( "dynsuffix{{" + hbmk_DYNSUFFIX( hbmk ) + "}}" + hb_eol() )
OutStd( "inc{{" + iif( hbmk[ _HBMK_lINC ], "yes", "no" ) + "}}" + hb_eol() )
OutStd( "hbctree{{" + hb_eol() )

View File

@@ -27,7 +27,7 @@ PRG_MAIN := hbtest.prg
LIBS = $(HB_LIBS_ST_RDD)
ifneq ($(filter $(HB_PLATFORM),win wce os2),)
ifneq ($(HB_BUILD_DLL),no)
ifneq ($(HB_BUILD_DYN),no)
HB_BUILD_SHARED := yes
endif
endif