From 96c2594c24cfd46eda4e51b66a19bb917d4da41a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 28 Jul 2010 15:42:23 +0000 Subject: [PATCH] 2010-07-28 17:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * package/harbour.spec * Minor in comment. * Temply commented adding .so files in the lib/ root (without harbour postfix) * contrib/make.hbs * contrib/hbpost.hbm + Added support for HB_MAN_INSTALL, HB_ETC_INSTALL. * utils/hbmk2/hbmk2.prg + Enabled multi-input compilation for *nix gcc family. This means that all C source files will be now compiled in one gcc invokation, instead of compiling them one by one. % PATHNORMALIZE(): delete unused function. % ISDRIVESPEC() converted to macro _ISDRIVESPEC(). * config/postinst.hbs + Added code to create ld config file. + Added commented original bash code to create .so links which I cannot understand. Anyone to jump in? + Added PathNormalize() function from hbmk2. + Changed back DirBuild() to always normalize path before creating it (to filter out potential ".." and "." dirs from it). Required for ld creation. * config/global.mk * HB_ETC_INSTALL is now format equally on all *nix platforms to have a 'harbour' subdir. Required to work well with ld creation logic in postinst.hbs. --- harbour/ChangeLog | 33 ++++++++++++- harbour/config/global.mk | 6 +-- harbour/config/postinst.hbs | 89 ++++++++++++++++++++++++++++++++++- harbour/contrib/hbpost.hbm | 2 + harbour/contrib/make.hbs | 2 + harbour/package/harbour.spec | 5 +- harbour/utils/hbmk2/hbmk2.prg | 74 ++++++++++++++--------------- 7 files changed, 164 insertions(+), 47 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 79de8d2121..b63c298f9a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,35 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-28 17:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * package/harbour.spec + * Minor in comment. + * Temply commented adding .so files in the lib/ root (without harbour postfix) + + * contrib/make.hbs + * contrib/hbpost.hbm + + Added support for HB_MAN_INSTALL, HB_ETC_INSTALL. + + * utils/hbmk2/hbmk2.prg + + Enabled multi-input compilation for *nix gcc family. This means that + all C source files will be now compiled in one gcc invokation, instead + of compiling them one by one. + % PATHNORMALIZE(): delete unused function. + % ISDRIVESPEC() converted to macro _ISDRIVESPEC(). + + * config/postinst.hbs + + Added code to create ld config file. + + Added commented original bash code to create .so links which I cannot + understand. Anyone to jump in? + + Added PathNormalize() function from hbmk2. + + Changed back DirBuild() to always normalize path before creating it + (to filter out potential ".." and "." dirs from it). Required for + ld creation. + + * config/global.mk + * HB_ETC_INSTALL is now format equally on all *nix platforms to have a + 'harbour' subdir. Required to work well with ld creation logic in postinst.hbs. + 2010-07-28 08:29 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbplistbox.prg + Added: method :setVisible(). @@ -23,10 +52,10 @@ * contrib/hbide/ideedit.prg * contrib/hbide/hbide.prg + Implemented: "Functions List" now supports "Sorted" and "Natural Order" - display which is switchable via right-click context menu. + display which is switchable via right-click context menu. * contrib/hbide/idedocks.prg - % Fixed: a rare bug where if hbIDE is minimized by any other action + % Fixed: a rare bug where if hbIDE is minimized by any other action than clicking on the "Minimize" title-bar icon on the right, on restoration it was producing RTE. diff --git a/harbour/config/global.mk b/harbour/config/global.mk index b6361408a3..f6934db8fc 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -1491,7 +1491,7 @@ ifeq ($(HB_BUILD_PKG),yes) HB_DOC_INSTALL := HB_MAN_INSTALL := ifeq ($(HB_PLATFORM),darwin) - export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)private$(DIRSEP)etc + export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)private$(DIRSEP)etc$(DIRSEP)harbour else HB_ETC_INSTALL := endif @@ -1661,9 +1661,9 @@ ifneq ($(HB_INSTALL_PREFIX),) # Do not set doc dir for non-*nix targets ifneq ($(HB_PLATFORM_UNIX),) ifeq ($(HB_PLATFORM),darwin) - export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)private$(DIRSEP)etc$(INCPOSTFIX) + export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)private$(DIRSEP)etc$(DIRSEP)harbour else - export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)etc$(INCPOSTFIX) + export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)etc$(DIRSEP)harbour endif endif endif diff --git a/harbour/config/postinst.hbs b/harbour/config/postinst.hbs index 1602cf51bf..323bf3fd2d 100644 --- a/harbour/config/postinst.hbs +++ b/harbour/config/postinst.hbs @@ -99,6 +99,15 @@ PROCEDURE Main() ELSE OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", GetEnv( "HB_ETC_INSTALL" ) ) + hb_eol() ) ENDIF + + OutStd( "! Creating *nix ld config file..." + hb_eol() ) + + tmp := GetEnv( "HB_ETC_INSTALL" ) + hb_ps() + ".." + hb_ps() + "ld.so.conf.d" + IF DirBuild( tmp ) + hb_MemoWrit( tmp + hb_ps() + "harbour.conf", GetEnv( "HB_LIB_INSTALL" ) + hb_eol() ) + ELSE + OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", tmp ) + hb_eol() ) + ENDIF ENDIF IF ! Empty( GetEnv( "HB_MAN_INSTALL" ) ) @@ -118,6 +127,44 @@ PROCEDURE Main() ENDIF ENDIF +#if 0 + for l in ${full_lib_name} ${full_lib_name_mt} + do + if [ -f $l ] + then + + ll="` echo $l | sed 's!'${lib_suff}'$!!' `${lib_ext}" + ln -sf $l $ll + + IF !( GetEnv( "HB_PLATFORM" ) $ "win|wce" ) + case $HB_LIB_INSTALL in + /usr/lib/harbour|/usr/lib64/harbour|/usr/local/lib/harbour|/usr/local/lib64/harbour) + ln -sf harbour/$l ../$ll + ln -sf harbour/$l ../$l + ;; + /usr/local/harbour/lib) + ld="/usr/lib" + if [ -n "${HB_INST_PKGPREF}" ] || [ -w $ld ] + then + mkdir -p ${HB_INST_PKGPREF}$ld + ln -sf ../local/harbour/lib/$l ${HB_INST_PKGPREF}$ld/$ll + ln -sf ../local/harbour/lib/$l ${HB_INST_PKGPREF}$ld/$l + fi + ;; + *) + ;; + esac + ld := "/etc/ld.so.conf.d" + if [ -d $ld ] && ( [ -n "${HB_INST_PKGPREF}" ] || [ -w $ld ] ) + then + mkdir -p ${HB_INST_PKGPREF}$ld + echo "$HB_LIB_INSTALL" > ${HB_INST_PKGPREF}/$ld/harbour.conf + fi + ENDIF + fi + done +#endif + /* Creating language files */ OutStd( "! Making core translation (.hbl) files..." + hb_eol() ) @@ -335,7 +382,7 @@ STATIC FUNCTION DirBuild( cDir ) LOCAL cDirItem LOCAL tmp - cDir := PathSepToSelf( cDir ) + cDir := PathNormalize( PathSepToSelf( cDir ) ) IF ! hb_DirExists( cDir ) @@ -371,6 +418,46 @@ STATIC FUNCTION DirBuild( cDir ) RETURN .T. +#define _ISDRIVESPEC( cDir ) ( ! Empty( hb_osDriveSeparator() ) .AND. Right( cDir, Len( hb_osDriveSeparator() ) ) == hb_osDriveSeparator() ) + +/* NOTE: Can hurt if there are symlinks on the way. */ +STATIC FUNCTION PathNormalize( cPath ) + LOCAL aDir + LOCAL cDir + + IF ! Empty( cPath ) + + aDir := hb_ATokens( cPath, hb_ps() ) + + FOR EACH cDir IN aDir DESCEND + IF cDir == "." + hb_ADel( aDir, cDir:__enumIndex(), .T. ) + ELSEIF !( cDir == ".." ) .AND. ; + ! Empty( cDir ) .AND. ; + ! _ISDRIVESPEC( cDir ) + IF cDir:__enumIndex() < Len( cDir:__enumBase() ) .AND. ; + aDir[ cDir:__enumIndex() + 1 ] == ".." + hb_ADel( aDir, cDir:__enumIndex() + 1, .T. ) + hb_ADel( aDir, cDir:__enumIndex(), .T. ) + ENDIF + ENDIF + NEXT + + cPath := "" + FOR EACH cDir IN aDir + cPath += cDir + IF cDir:__enumIndex() < Len( cDir:__enumBase() ) + cPath += hb_ps() + ENDIF + NEXT + + IF Empty( cPath ) + cPath := "." + hb_ps() + ENDIF + ENDIF + + RETURN cPath + STATIC FUNCTION DirAddPathSep( cDir ) IF ! Empty( cDir ) .AND. !( Right( cDir, 1 ) == hb_ps() ) diff --git a/harbour/contrib/hbpost.hbm b/harbour/contrib/hbpost.hbm index 1f50735377..f46d3d205b 100644 --- a/harbour/contrib/hbpost.hbm +++ b/harbour/contrib/hbpost.hbm @@ -46,4 +46,6 @@ {_HB_BUILD_INSTALL&hbexe}-instpath=${_HB_BIN_INSTALL}/ {_HB_BUILD_INSTALL&hbdyn}-instpath=${_HB_DYN_INSTALL}/ {_HB_BUILD_INSTALL&hblib}-instpath=inc:${_HB_INC_INSTALL}/ +{_HB_BUILD_INSTALL}-instpath=etc:${_HB_ETC_INSTALL}/ +{_HB_BUILD_INSTALL}-instpath=man:${_HB_MAN_INSTALL}/ {_HB_BUILD_INSTALL&HB_INSTALL_IMPLIB='yes'}-instpath=implib:${_HB_LIB_INSTALL}/ diff --git a/harbour/contrib/make.hbs b/harbour/contrib/make.hbs index 38b88601fd..4a3b5a818c 100755 --- a/harbour/contrib/make.hbs +++ b/harbour/contrib/make.hbs @@ -325,6 +325,8 @@ PROCEDURE GNUMake( aParams, hPackageList ) hb_setenv( "_HB_LIB_INSTALL", GetEnv( "HB_LIB_INSTALL" ) ) hb_setenv( "_HB_DYN_INSTALL", GetEnv( "HB_DYN_INSTALL" ) ) hb_setenv( "_HB_INC_INSTALL", GetEnv( "HB_INC_INSTALL" ) ) + hb_setenv( "_HB_MAN_INSTALL", GetEnv( "HB_MAN_INSTALL" ) ) + hb_setenv( "_HB_ETC_INSTALL", GetEnv( "HB_ETC_INSTALL" ) ) /* Override hbmk2 autodetection */ hb_setenv( "HB_INSTALL_PREFIX", s_cRoot ) diff --git a/harbour/package/harbour.spec b/harbour/package/harbour.spec index fc8b2956f9..6c6784223c 100644 --- a/harbour/package/harbour.spec +++ b/harbour/package/harbour.spec @@ -399,7 +399,7 @@ make %{?_smp_mflags} export HB_BUILD_STRIP=all export HB_BUILD_SHARED=%{!?_with_static:yes} -# necessary for shared linked hbrun used to execute postinst.prg +# necessary for shared linked hbrun used to execute postinst.hbs export LD_LIBRARY_PATH=$HB_LIB_INSTALL make install %{?_smp_mflags} @@ -488,7 +488,8 @@ rm -rf $RPM_BUILD_ROOT %defattr(755,root,root,755) %dir %{_libdir}/%{name} %{_libdir}/%{name}/*.so -%{_libdir}/*.so +# Temporarily commented +#%{_libdir}/*.so %{?hb_ldconf:%{hb_ldconf}/%{name}.conf} %files contrib diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 4da1f90dd3..cd188d8d87 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -2936,15 +2936,20 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) ENDIF cOpt_CompC += " {FC}" IF ! Empty( hbmk[ _HBMK_cWorkDir ] ) - IF hbmk[ _HBMK_cPLAT ] $ "linux|bsd" .AND. hbmk[ _HBMK_cCOMP ] == "clang" - /* NOTE: It's also accepted by darwin/clang */ - cOpt_CompC += " {IC} -o{OO}" + IF .T. /* EXPERIMENTAL */ + lCHD_Comp := .T. + cOpt_CompC += " {LC}" ELSE - cOpt_CompC += " {IC} -o {OO}" - IF hbmk[ _HBMK_cCOMP ] $ "icc|gcc" - AAdd( hbmk[ _HBMK_aOPTC ], "-pipe" ) + IF hbmk[ _HBMK_cPLAT ] $ "linux|bsd" .AND. hbmk[ _HBMK_cCOMP ] == "clang" + /* NOTE: It's also accepted by darwin/clang */ + cOpt_CompC += " {IC} -o{OO}" + ELSE + cOpt_CompC += " {IC} -o {OO}" ENDIF ENDIF + IF hbmk[ _HBMK_cCOMP ] $ "icc|gcc" + AAdd( hbmk[ _HBMK_aOPTC ], "-pipe" ) + ENDIF ELSE cOpt_CompC += " {LC}" ENDIF @@ -7755,50 +7760,41 @@ STATIC FUNCTION ListToArray( cList, cSep ) RETURN array -STATIC FUNCTION IsDriveSpec( cDir ) - RETURN ! Empty( hb_osDriveSeparator() ) .AND. ; - Right( cDir, Len( hb_osDriveSeparator() ) ) == hb_osDriveSeparator() +#define _ISDRIVESPEC( cDir ) ( ! Empty( hb_osDriveSeparator() ) .AND. Right( cDir, Len( hb_osDriveSeparator() ) ) == hb_osDriveSeparator() ) /* NOTE: Can hurt if there are symlinks on the way. */ -STATIC FUNCTION PathNormalize( cPath, lNormalize ) +STATIC FUNCTION PathNormalize( cPath ) LOCAL aDir LOCAL cDir IF ! Empty( cPath ) - IF ! ISLOGICAL( lNormalize ) - lNormalize := .T. - ENDIF + aDir := hb_ATokens( cPath, hb_ps() ) - IF lNormalize - - aDir := hb_ATokens( cPath, hb_ps() ) - - FOR EACH cDir IN aDir DESCEND - IF cDir == "." + FOR EACH cDir IN aDir DESCEND + IF cDir == "." + hb_ADel( aDir, cDir:__enumIndex(), .T. ) + ELSEIF !( cDir == ".." ) .AND. ; + ! Empty( cDir ) .AND. ; + ! _ISDRIVESPEC( cDir ) + IF cDir:__enumIndex() < Len( cDir:__enumBase() ) .AND. ; + aDir[ cDir:__enumIndex() + 1 ] == ".." + hb_ADel( aDir, cDir:__enumIndex() + 1, .T. ) hb_ADel( aDir, cDir:__enumIndex(), .T. ) - ELSEIF !( cDir == ".." ) .AND. ; - ! Empty( cDir ) .AND. ; - ! IsDriveSpec( cDir ) - IF cDir:__enumIndex() < Len( cDir:__enumBase() ) .AND. ; - aDir[ cDir:__enumIndex() + 1 ] == ".." - hb_ADel( aDir, cDir:__enumIndex() + 1, .T. ) - hb_ADel( aDir, cDir:__enumIndex(), .T. ) - ENDIF ENDIF - NEXT - - cPath := "" - FOR EACH cDir IN aDir - cPath += cDir - IF cDir:__enumIndex() < Len( cDir:__enumBase() ) - cPath += hb_ps() - ENDIF - NEXT - - IF Empty( cPath ) - cPath := "." + hb_ps() ENDIF + NEXT + + cPath := "" + FOR EACH cDir IN aDir + cPath += cDir + IF cDir:__enumIndex() < Len( cDir:__enumBase() ) + cPath += hb_ps() + ENDIF + NEXT + + IF Empty( cPath ) + cPath := "." + hb_ps() ENDIF ENDIF