2010-07-26 20:43 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* debian/rules
  * harbour.spec
  * config/instsh.mk
    * Do not use HB_INST_PKGPREF.

  * harbour.spec
    + Use HB_MAN_INSTALL

  * config/global.mk
    + Added HB_MAN_INSTALL and HB_ETC_INSTALL
    + PKG_NAME is now filled in little bit different way for
      *nix systems to emulate old mpkg_tgz.sh logic.

  * bin/postinst.sh
    - Deleted no more used subroutines.
    - Deleted mk_hblibso() function.
      - it maintained loca list of contribs which breaks the
        effort of contrib "plug-in" system
      - it contained lots of platform dependent build details in
        hard to maintain bash shell code.
      ; If someone needs this functionality pls try to integrate
        it in hbmk2 or write a .hbs script in modular fashion
        (not contrib names). I cannot tell what exactly was the functionality
        implemented there though. Maybe rewriting it locally is also an
        option.
    ! Do not use HB_INST_PKGPREF.

  * config/postinst.hbs
    + Rewritten mpkg_tgz.sh logic in .prg code. This logic is
      finally in it's proper place.
    + Implemented copying of man files on *nix systems.
    ; NOTE: Not tested at all, it was hard enough to rewrite it,
            pls help on finishing and debugging it. See TODOs in
            source. Previous replicated with some differences.

  - mpkg_tgz.sh
    - Deleted. Now implemented in postinst.sh.
      Build Harbour with HB_BUILD_PKG=yes to try it.

  * INSTALL
    + Added HB_MAN_INSTALL and HB_ETC_INSTALL
    + Updated .tgz binary instructions (now same on all platforms)

  * utils/hbrun/hbrun.prg
  * utils/hbrun/hbrun.hbp
  * utils/hbrun/Makefile
    * Renamed include dir control var.
    * Change so that now simple HB_INC_INSTALL value will
      trigger burn-in of header location.
    + Added logic to only use burnt-in header location if
      it is an absolute path.
    ! Synced .hbp file with this feature.
    ; NOTE: This is still non-portable and error
            prone solution. Pls see my thought on dev list
            about possible solutions to use precompiled
            Harbour headers compiled right into the executable.
This commit is contained in:
Viktor Szakats
2010-07-26 18:44:08 +00:00
parent a29bb9d822
commit bd90e07276
12 changed files with 398 additions and 468 deletions

View File

@@ -16,6 +16,64 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-07-26 20:43 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* debian/rules
* harbour.spec
* config/instsh.mk
* Do not use HB_INST_PKGPREF.
* harbour.spec
+ Use HB_MAN_INSTALL
* config/global.mk
+ Added HB_MAN_INSTALL and HB_ETC_INSTALL
+ PKG_NAME is now filled in little bit different way for
*nix systems to emulate old mpkg_tgz.sh logic.
* bin/postinst.sh
- Deleted no more used subroutines.
- Deleted mk_hblibso() function.
- it maintained loca list of contribs which breaks the
effort of contrib "plug-in" system
- it contained lots of platform dependent build details in
hard to maintain bash shell code.
; If someone needs this functionality pls try to integrate
it in hbmk2 or write a .hbs script in modular fashion
(not contrib names). I cannot tell what exactly was the functionality
implemented there though. Maybe rewriting it locally is also an
option.
! Do not use HB_INST_PKGPREF.
* config/postinst.hbs
+ Rewritten mpkg_tgz.sh logic in .prg code. This logic is
finally in it's proper place.
+ Implemented copying of man files on *nix systems.
; NOTE: Not tested at all, it was hard enough to rewrite it,
pls help on finishing and debugging it. See TODOs in
source. Previous replicated with some differences.
- mpkg_tgz.sh
- Deleted. Now implemented in postinst.sh.
Build Harbour with HB_BUILD_PKG=yes to try it.
* INSTALL
+ Added HB_MAN_INSTALL and HB_ETC_INSTALL
+ Updated .tgz binary instructions (now same on all platforms)
* utils/hbrun/hbrun.prg
* utils/hbrun/hbrun.hbp
* utils/hbrun/Makefile
* Renamed include dir control var.
* Change so that now simple HB_INC_INSTALL value will
trigger burn-in of header location.
+ Added logic to only use burnt-in header location if
it is an absolute path.
! Synced .hbp file with this feature.
; NOTE: This is still non-portable and error
prone solution. Pls see my thought on dev list
about possible solutions to use precompiled
Harbour headers compiled right into the executable.
2010-07-26 15:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/fscopy.c
! Fixed to properly set FERROR() values.

View File

@@ -218,7 +218,8 @@ HARBOUR
Binary .tgz on *nixes
---------------------
$ ./mpkg_tgz.sh
$ export HB_BUILD_PKG=yes
$ make
Binary .deb on Linux
--------------------
@@ -629,6 +630,8 @@ HARBOUR
- HB_DYN_INSTALL Override directory to install dynamic libraries
- HB_INC_INSTALL Override directory to install language headers
- HB_DOC_INSTALL Override directory to install documentation
- HB_MAN_INSTALL Override directory to install *nix man files
- HB_ETC_INSTALL Override directory to install *nix config files
Special
-------
@@ -641,7 +644,6 @@ 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.
(currently on Windows/Windows CE/MS-DOS)
- HB_BUILD_DLL=no Create Harbour dynamic libraries. Default: yes
- HB_BUILD_SHARED=yes Create Harbour executables in shared mode.
Default: yes when HB_INSTALL_PREFIX points

View File

@@ -45,216 +45,6 @@ __builtin_which()
return $ret
}
get_solibname()
{
name="${HB_SHAREDLIB_NAME}"
[ -z "${name}" ] && name="harbour"
echo "${name}"
}
get_hbver_so()
{
if [ "${HB_PLATFORM}" = "win" ] || \
[ "${HB_PLATFORM}" = "wce" ]; then
hb_ver_so=`get_hbver_win "${1-.}"`
if [ "${HB_COMPILER}" = "mingw64" ]; then
hb_ver_so="${hb_ver_so}-x64"
elif [ "${HB_COMPILER}" = "mingwarm" ]; then
hb_ver_so="${hb_ver_so}-wce-arm"
fi
else
hb_ver_so=`get_hbver "${1-.}"`
fi
echo "${hb_ver_so}"
}
mk_hbgetlibs()
{
if [ -z "$@" ]
then
libs=""
if [ "$HB_PLATFORM" != "wce" ]
then
libs="$libs gtwin"
fi
echo "hbextern hbvm hbpp hbrtl hbrdd rddfpt rddcdx rddnsx rddntx hbhsx hbsix hbusrrdd hbmacro hbcommon hblang hbcpage gtcrs gtsln gtxvt gtxwc gtcgi gtstd gtpca gttrm $libs gtwvt gtgui gtdos gtos2 hbdebug profiler hbcplr hbpcre hbzlib"
else
echo "$@"
fi
}
mk_hblibso()
{
dir=`pwd`
name=`get_solibname`
hb_ver=`get_hbver_so "${1-.}"`
hb_libs=`mk_hbgetlibs "$2"`
if [ -n "${HB_USER_DLL_ADDONS}" ]; then
hb_libs="${hb_libs} ${HB_USER_DLL_ADDONS}"
fi
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
(cd ${HB_INST_PKGPREF}${HB_LIB_INSTALL}
LIBS=""
LIBSMT=""
gpm="${HB_HAS_GPM}"
if [ "${HB_PLATFORM}" = "beos" ]; then
linker_options="-L/system/lib -lroot -lnetwork"
else
linker_options="-lm"
fi
linker_mtoptions=""
if echo ${HB_USER_CFLAGS} | grep -- -DHB_POSIX_REGEX >/dev/null 2>&1 ; then
hb_libs="` echo ${hb_libs} | sed 's!hbpcre!!g' `"
elif [ -z "${HB_HAS_PCRE_LOCAL}" ]; then
linker_options="-lpcre ${linker_options}"
hb_libs="` echo ${hb_libs} | sed 's!hbpcre!!g' `"
fi
if [ -z "${HB_HAS_ZLIB_LOCAL}" ]; then
linker_options="-lz ${linker_options}"
hb_libs="` echo ${hb_libs} | sed 's!hbzlib!!g' `"
fi
if [ "${HB_COMPILER}" = "mingw" ] || [ "${HB_COMPILER}" = "mingw64" ]; then
linker_options="${linker_options} -luser32 -lwinspool -lgdi32 -lcomctl32 -ladvapi32 -lcomdlg32 -lole32 -loleaut32 -luuid -lws2_32"
elif [ "${HB_COMPILER}" = "mingwarm" ]; then
linker_options="${linker_options} -lwininet -lws2 -lcommdlg -lcommctrl -luuid -lole32 -loleaut32"
elif [ "${HB_COMPILER}" = "djgpp" ]; then
linker_options="${linker_options}"
elif [ "${HB_PLATFORM}" = "linux" ]; then
linker_options="${linker_options} -ldl -lrt"
linker_mtoptions="${linker_mtoptions} -lpthread"
elif [ "${HB_PLATFORM}" = "sunos" ]; then
linker_options="${linker_options} -lrt -lsocket -lnsl -lresolv"
linker_mtoptions="${linker_mtoptions} -lpthread"
elif [ "${HB_PLATFORM}" = "hpux" ]; then
linker_options="${linker_options} -lrt"
linker_mtoptions="${linker_mtoptions} -lpthread"
elif [ "${HB_PLATFORM}" = "bsd" ]; then
linker_options="$-L/usr/local/lib {linker_options}"
linker_mtoptions="${linker_mtoptions} -lpthread"
elif [ "${HB_PLATFORM}" = "darwin" ]; then
linker_options="-L/sw/lib -L/opt/local/lib ${linker_options}"
linker_mtoptions="${linker_mtoptions} -lpthread"
fi
for l in ${hb_libs}
do
case $l in
hbdebug|profiler|hbcplr|hbodbc|gtalleg|rddads) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]
then
lm="lib${l}mt.a"
else
lm="${ls}"
fi
if [ -f $lm ]
then
LIBSMT="$LIBSMT $lm"
fi
if [ -f $ls ]
then
LIBS="$LIBS $ls"
if [ "${l}" = gtcrs ]; then
if [ "${HB_PLATFORM}" = "sunos" ] || \
[ "${HB_PLATFORM}" = "bsd" ]; then
linker_options="$linker_options -lcurses"
else
linker_options="$linker_options -lncurses"
fi
elif [ "${l}" = gtsln ]; then
linker_options="$linker_options -lslang"
elif [ "${l}" = gtxwc ]; then
[ -d "/usr/X11R6/lib64" ] && \
linker_options="$linker_options -L/usr/X11R6/lib64"
[ -d "/usr/X11R6/lib" ] && \
linker_options="$linker_options -L/usr/X11R6/lib"
linker_options="$linker_options -lX11"
fi
if [ -n "${gpm}" ] && ( [ "${l}" = gtcrs ] || \
[ "${l}" = gtsln ] || [ "${l}" = gttrm ] ); then
linker_options="$linker_options -lgpm"
gpm=""
fi
fi
;;
esac
done
if [ "${HB_PLATFORM}" = "darwin" ]; then
lib_ext=".dylib"
lib_pref="lib"
lib_suff=".${hb_ver}${lib_ext}"
elif [ "${HB_PLATFORM}" = "win" ] || \
[ "${HB_PLATFORM}" = "wce" ]; then
lib_ext=".dll"
lib_pref=""
lib_suff="-${hb_ver}${lib_ext}"
elif [ "${HB_PLATFORM}" = "hpux" ]; then
lib_ext=".sl"
lib_pref="lib"
lib_suff="-${hb_ver}${lib_ext}"
else
lib_ext=".so"
lib_pref="lib"
lib_suff="-${hb_ver}${lib_ext}"
fi
full_lib_name="${lib_pref}${name}${lib_suff}"
full_lib_name_mt="${lib_pref}${name}mt${lib_suff}"
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/${HB_TOOLS_PREF-hb}-mkdyn"
if [ -n "${HB_USER_DLL_ADDONS}" ]; then
echo "Making ${full_lib_name}..."
${hb_mkdyn} ${full_lib_name} ${LIBS} ${linker_options}
if [ "${LIBS}" != "${LIBSMT}" ]; then
echo "Making ${full_lib_name_mt}..."
${hb_mkdyn} ${full_lib_name_mt} ${LIBSMT} ${linker_mtoptions} ${linker_options}
fi
fi
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 [ "${HB_PLATFORM}" = "win" ] || \
[ "${HB_PLATFORM}" = "wce" ]; then
if [ "${HB_PLATFORM}" = "${HB_HOST_PLAT}" ]; then
(cd "$dir"
mv "${HB_INST_PKGPREF}${HB_LIB_INSTALL}/$l" "${HB_INST_PKGPREF}${HB_BIN_INSTALL}"
mv "${HB_INST_PKGPREF}${HB_LIB_INSTALL}/$ll" "${HB_INST_PKGPREF}${HB_BIN_INSTALL}")
fi
else
case $HB_LIB_INSTALL in
/usr/lib/${name}|/usr/lib64/${name}|/usr/local/lib/${name}|/usr/local/lib64/${name})
ln -sf ${name}/$l ../$ll
ln -sf ${name}/$l ../$l
;;
/usr/local/${name}/lib)
ld="/usr/lib"
if [ -n "${HB_INST_PKGPREF}" ] || [ -w $ld ]
then
mkdir -p ${HB_INST_PKGPREF}$ld
ln -sf ../local/${name}/lib/$l ${HB_INST_PKGPREF}$ld/$ll
ln -sf ../local/${name}/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/${name}.conf
fi
fi
fi
done
)
#export LD_LIBRARY_PATH="${HB_INST_PKGPREF}$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
}
if [ -z "$HB_PLATFORM" ] || [ -z "$HB_COMPILER" ] || \
[ -z "$HB_BIN_INSTALL" ] || \
[ -z "$HB_INC_INSTALL" ] || \
@@ -285,7 +75,7 @@ fi
__install="` __builtin_which install `"
# chmod 644 ${HB_INST_PKGPREF}${HB_INC_INSTALL}/*
# chmod 644 ${HB_INC_INSTALL}/*
if [ "$HB_COMPILER" = "gcc" ] || \
[ "$HB_COMPILER" = "mingw" ] || \
@@ -299,7 +89,7 @@ if [ "$HB_COMPILER" = "gcc" ] || \
[ "$HB_COMPILER" = "clang" ]
then
if [ -n "${HB_TOOLS_PREF}" ]; then
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/${HB_TOOLS_PREF}-mkdyn"
hb_mkdyn="${HB_BIN_INSTALL}/${HB_TOOLS_PREF}-mkdyn"
rm -f "${hb_mkdyn}"
sed -e "s!^# HB_PLATFORM=\"\"\$!HB_PLATFORM=\"${HB_PLATFORM}\"!g" \
-e "s!^# HB_CCPREFIX=\"\"\$![ -n \"\${HB_CCPREFIX}\" ] || HB_CCPREFIX=\"${HB_CCPREFIX}\"!g" \
@@ -307,12 +97,12 @@ then
"${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \
chmod 755 "${hb_mkdyn}"
elif [ "$HB_COMPILER" = "icc" ]; then
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
rm -f "${hb_mkdyn}"
sed -e "s/gcc/icc/g" "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \
chmod 755 "${hb_mkdyn}"
elif [ "$HB_COMPILER" = "sunpro" ]; then
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
rm -f "${hb_mkdyn}"
lnopt=""
[ "$HB_BUILD_OPTIM" = "no" ] || lnopt="-fast -xnolibmopt $lnopt"
@@ -320,24 +110,20 @@ then
"${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \
chmod 755 "${hb_mkdyn}"
elif [ "$HB_COMPILER" = "open64" ]; then
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
rm -f "${hb_mkdyn}"
sed -e "s/gcc/opencc/g" "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \
chmod 755 "${hb_mkdyn}"
elif [ "${HB_PLATFORM}" = "sunos" ] || \
[ "${HB_PLATFORM}" = "hpux" ] || \
[ -z "${__install}" ]; then
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
rm -f "${hb_mkdyn}"
cp "${hb_root}/bin/hb-mkdyn.sh" "${hb_mkdyn}" && \
chmod 755 "${hb_mkdyn}"
elif [ "${HB_PLATFORM}" != "dos" ]; then
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
# Without -c some OSes _move_ the file instead of copying it!
${__install} -c -m 755 "${hb_root}/bin/hb-mkdyn.sh" "${hb_mkdyn}"
fi
if [ "${HB_PLATFORM}" != "dos" ]; then
mk_hblibso "${hb_root}"
fi
fi

View File

@@ -266,6 +266,12 @@ ifeq ($(HB_INIT_DONE),)
ifneq ($(HB_DOC_INSTALL),)
$(info ! HB_DOC_INSTALL: $(HB_DOC_INSTALL))
endif
ifneq ($(HB_MAN_INSTALL),)
$(info ! HB_MAN_INSTALL: $(HB_MAN_INSTALL))
endif
ifneq ($(HB_ETC_INSTALL),)
$(info ! HB_ETC_INSTALL: $(HB_ETC_INSTALL))
endif
ifneq ($(HB_BUILD_NAME),)
$(info ! HB_BUILD_NAME: $(HB_BUILD_NAME))
endif
@@ -1404,8 +1410,16 @@ ifneq ($(HB_HAS_X11),)
endif
ifneq ($(HB_PLATFORM),dos)
HB_VERSION := $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE)$(HB_VER_STATUS)
HB_PKGNAME := harbour-$(HB_VERSION)-$(HB_PLATFORM)-$(HB_COMPILER)
ifneq ($(HB_PLATFORM_UNIX),)
HB_VERSION := $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE)
ifneq ($(HB_VER_STATUS),)
HB_VERSION := $(HB_VERSION)-$(HB_VER_STATUS)
endif
HB_PKGNAME := harbour-$(HB_VERSION)
else
HB_VERSION := $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE)$(HB_VER_STATUS)
HB_PKGNAME := harbour-$(HB_VERSION)-$(HB_PLATFORM)-$(HB_COMPILER)
endif
HB_PKGNAMI := $(HB_PKGNAME)
else
# Use short names in MS-DOS
@@ -1442,6 +1456,8 @@ ifeq ($(HB_BUILD_PKG),yes)
HB_LIB_INSTALL :=
HB_DYN_INSTALL :=
HB_DOC_INSTALL :=
HB_MAN_INSTALL :=
HB_ETC_INSTALL :=
endif
else
# Fill it automatically if not specified
@@ -1592,6 +1608,24 @@ ifneq ($(HB_INSTALL_PREFIX),)
export HB_DOC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)doc
endif
endif
# Standard name: MANDIR
ifeq ($(HB_MAN_INSTALL),)
# Do not set doc dir for non-*nix targets
ifneq ($(HB_PLATFORM_UNIX),)
export HB_MAN_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)man$(INCPOSTFIX)
endif
endif
# Standard name: ETCDIR
ifeq ($(HB_ETC_INSTALL),)
# 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/etc$(INCPOSTFIX)
else
export HB_ETC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)etc$(INCPOSTFIX)
endif
endif
endif
endif
export HB_OBJ_DIR := $(subst /,$(DIRSEP),$(OBJ_DIR))

View File

@@ -26,10 +26,10 @@ ifeq ($(_SAME_DIR),yes)
else
ifneq ($(HB_SHELL),sh)
INSTALL_DIR_OS := $(subst /,\,$(HB_INST_PKGPREF)$(INSTALL_DIR))
INSTALL_DIR_OS := $(subst /,\,$(INSTALL_DIR))
INSTALL_FILES_OS := $(subst /,\,$(INSTALL_FILES))
else
INSTALL_DIR_OS := $(subst \,/,$(HB_INST_PKGPREF)$(INSTALL_DIR))
INSTALL_DIR_OS := $(subst \,/,$(INSTALL_DIR))
endif
ifeq ($(HB_SHELL),sh)

View File

@@ -13,8 +13,22 @@
#pragma warninglevel=3
/* TOFIX: Ugly hack to avoid #include "directry.ch" */
#define F_NAME 1 /* File name */
#define F_ATTR 5 /* File attribute */
#define F_NAME 1 /* File name */
#define F_ATTR 5 /* File attribute */
/* POSIX file permission */
#define HB_FA_SUID 0x08000000 /* 4000 set user ID on execution */
#define HB_FA_SGID 0x04000000 /* 2000 set group ID on execution */
#define HB_FA_SVTX 0x02000000 /* 1000 sticky bit */
#define HB_FA_RUSR 0x01000000 /* 0400 read by owner */
#define HB_FA_WUSR 0x00800000 /* 0200 write by owner */
#define HB_FA_XUSR 0x00400000 /* 0100 execute/search by owner */
#define HB_FA_RGRP 0x00200000 /* 0040 read by group */
#define HB_FA_WGRP 0x00100000 /* 0020 write by group */
#define HB_FA_XGRP 0x00080000 /* 0010 execute/search by group */
#define HB_FA_ROTH 0x00040000 /* 0004 read by others */
#define HB_FA_WOTH 0x00020000 /* 0002 write by others */
#define HB_FA_XOTH 0x00010000 /* 0001 execute/search by others */
PROCEDURE Main()
LOCAL nErrorLevel := 0
@@ -23,6 +37,15 @@ PROCEDURE Main()
LOCAL tmp
LOCAL cOldDir
LOCAL cTar_Name
LOCAL cTar_Path
LOCAL cBin_Tar
LOCAL lGNU_Tar
LOCAL cOwner
LOCAL cGroup
LOCAL cSH_Script
LOCAL nAttr
IF Empty( GetEnv( "HB_PLATFORM" ) ) .OR. ;
Empty( GetEnv( "HB_COMPILER" ) ) .OR. ;
Empty( GetEnv( "HB_BIN_INSTALL" ) ) .OR. ;
@@ -55,6 +78,29 @@ PROCEDURE Main()
NEXT
ENDIF
IF !( GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" ) .AND. ;
! Empty( GetEnv( "HB_ETC_INSTALL" ) ) .AND. ;
GetEnv( "HB_SYSLOC" ) == "yes"
OutStd( "! Copying *nix config files..." + hb_eol() )
DirBuild( GetEnv( "HB_ETC_INSTALL" ) )
mk_FCopyToDir( "src/rtl/gtcrs/hb-charmap.def", GetEnv( "HB_ETC_INSTALL" ) + hb_ps(), .T. )
ENDIF
IF ! Empty( GetEnv( "HB_MAN_INSTALL" ) )
OutStd( "! Copying *nix man files..." + hb_eol() )
FOR EACH tmp IN { "src/main/harbour.1" ,;
"src/pp/hbpp.1" ,;
"utils/hbmk2/hbmk2.1" ,;
"utils/hbrun/hbrun.1" ,;
"utils/hbtest/hbtest.1" }
mk_FCopyToDir( tmp, GetEnv( "HB_ETC_INSTALL" ) + hb_ps() + "man1" + hb_ps(), .T. )
NEXT
ENDIF
/* Creating language files */
OutStd( "! Making core translation (.hbl) files..." + hb_eol() )
@@ -76,42 +122,122 @@ PROCEDURE Main()
/* Creating install packages */
IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" .AND. ;
GetEnv( "HB_BUILD_PKG" ) == "yes" .AND. ;
IF GetEnv( "HB_BUILD_PKG" ) == "yes" .AND. ;
! Empty( GetEnv( "HB_TOP" ) )
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".zip"
IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos"
OutStd( "! Making Harbour .zip install package: '" + tmp + "'" + hb_eol() )
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".zip"
FErase( tmp )
OutStd( "! Making Harbour .zip install package: '" + tmp + "'" + hb_eol() )
/* NOTE: Believe it or not this is the official method to zip a different dir with subdirs
without including the whole root path in filenames; you have to 'cd' into it.
Even with zip 3.0. For this reason we need absolute path in HB_TOP. There is also
no zip 2.x compatible way to force creation of a new .zip, so we have to delete it
first to avoid mixing in an existing .zip file. [vszakats] */
FErase( tmp )
cOldDir := hb_ps() + CurDir()
DirChange( GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + ".." )
/* NOTE: Believe it or not this is the official method to zip a different dir with subdirs
without including the whole root path in filenames; you have to 'cd' into it.
Even with zip 3.0. For this reason we need absolute path in HB_TOP. There is also
no zip 2.x compatible way to force creation of a new .zip, so we have to delete it
first to avoid mixing in an existing .zip file. [vszakats] */
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_ZIP" ) ) + "zip" +;
" -q -9 -X -r -o" +;
" " + FNameEscape( tmp ) +;
" . -i " + FNameEscape( GetEnv( "HB_PKGNAME" ) + hb_ps() + "*" ) +;
" -x *.tds -x *.exp" )
cOldDir := hb_ps() + CurDir()
DirChange( GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + ".." )
DirChange( cOldDir )
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_ZIP" ) ) + "zip" +;
" -q -9 -X -r -o" +;
" " + FNameEscape( tmp ) +;
" . -i " + FNameEscape( GetEnv( "HB_PKGNAME" ) + hb_ps() + "*" ) +;
" -x *.tds -x *.exp" )
IF GetEnv( "HB_PLATFORM" ) $ "win|wce"
DirChange( cOldDir )
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".exe"
IF GetEnv( "HB_PLATFORM" ) $ "win|wce"
OutStd( "! Making Harbour .exe install package: '" + tmp + "'" + hb_eol() )
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".exe"
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_NSIS" ) ) + "makensis.exe" +;
" -V2" +;
" " + FNameEscape( StrTran( "package/mpkg_win.nsi", "/", hb_ps() ) ) )
OutStd( "! Making Harbour .exe install package: '" + tmp + "'" + hb_eol() )
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_NSIS" ) ) + "makensis.exe" +;
" -V2" +;
" " + FNameEscape( StrTran( "package/mpkg_win.nsi", "/", hb_ps() ) ) )
ENDIF
ELSE
cBin_Tar := "tar"
lGNU_Tar := .T.
IF ! Empty( query_stdout( "gtar --version" ) )
cBin_Tar := "gtar"
ELSEIF ! Empty( query_stdout( "tar --version" ) )
cBin_Tar := ""
ELSEIF "bsdtar" $ query_stdout( "tar --version" )
/* tar is mapped to bsdtar starting OS X 10.6 */
lGNU_Tar := .F.
ENDIF
IF ! Empty( cBin_Tar )
cTar_Name := GetEnv( "HB_PKGNAME" )
IF ! Empty( tmp := unix_name() )
cTar_Name += tmp
ENDIF
cTar_Name += iif( GetEnv( "HB_PLATFORM" ) == "dos", ".tgz", ".bin.tar.gz" )
cTar_Path := GetEnv( "HB_TOP" ) + hb_ps() + cTar_Name
OutStd( "! Making Harbour tar install package: '" + cTar_Path + "'" + hb_eol() )
FErase( cTar_Path )
cOwner := "root"
cGroup := iif( GetEnv( "HB_PLATFORM" ) == "darwin" .OR. ;
GetEnv( "HB_PLATFORM" ) == "bsd", "wheel", "root" )
cOldDir := hb_ps() + CurDir()
DirChange( GetEnv( "HB_INSTALL_PREFIX" ) )
/* TODO: Add support for non-GNU non-BSD tar (which gets the data from stdio) */
mk_hb_processRun( cBin_Tar +;
" czvf" +;
" " + FNameEscape( cTar_Path ) +;
iif( lGNU_Tar, " --owner=" + cOwner, "" ) +;
iif( lGNU_Tar, " --group=" + cGroup, "" ) +;
" ." )
DirChange( cOldDir )
IF !( GetEnv( "HB_PLATFORM" ) == "dos" )
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".inst.sh"
OutStd( "! Making Harbour tar installer package: '" + tmp + "'" + hb_eol() )
/* In the generated script always use tar because we can't be sure
if cBin_Tar exists in the installation environment */
cSH_Script := '#!/bin/sh'
cSH_Script += 'if [ "\$1" = "--extract" ]; then'
cSH_Script += ' tail -c ' + hb_ntos( hb_FSize( cTar_Path ) ) + ' "\$0" > "' + cTar_Name + '"'
cSH_Script += ' exit'
cSH_Script += 'fi'
cSH_Script += 'if [ \`id -u\` != 0 ]; then'
cSH_Script += ' echo "This package has to be installed from root account."'
cSH_Script += ' exit 1'
cSH_Script += 'fi'
cSH_Script += 'echo "Do you want to install Harbour (y/n)"'
cSH_Script += 'read ASK'
cSH_Script += 'if [ "\${ASK}" != "y" ] && [ "\${ASK}" != "Y" ]; then'
cSH_Script += ' exit 1'
cSH_Script += 'fi'
cSH_Script += '(tail -c ' + hb_ntos( hb_FSize( cTar_Path ) ) + ' "\$0" | gzip -cd | (cd /;tar xvpf -)) ' + iif( GetEnv( "HB_PLATFORM" ) == "linux", "&& ldconfig", "" )
cSH_Script += 'exit \$?'
cSH_Script += 'HB_INST_EOF'
hb_MemoWrite( tmp, cSH_Script )
hb_FGetAttr( tmp, @nAttr )
hb_FSetAttr( tmp, hb_bitOr( nAttr, HB_FA_XOTH ) )
ENDIF
ELSE
OutStd( "! Error: Cannot find 'tar'" + hb_eol() )
ENDIF
ENDIF
ENDIF
@@ -188,3 +314,99 @@ STATIC FUNCTION FNameExtSet( cFileName, cExt )
STATIC FUNCTION PathSepToSelf( cFileName )
RETURN StrTran( cFileName, iif( hb_ps() == "\", "/", "\" ), hb_ps() )
STATIC FUNCTION DirBuild( cDir )
LOCAL cDirTemp
LOCAL cDirItem
LOCAL tmp
IF ! hb_DirExists( cDir )
cDir := DirAddPathSep( cDir )
IF ! Empty( hb_osDriveSeparator() ) .AND. ;
( tmp := At( hb_osDriveSeparator(), cDir ) ) > 0
cDirTemp := Left( cDir, tmp )
cDir := SubStr( cDir, tmp + 1 )
ELSE
cDirTemp := ""
ENDIF
FOR EACH cDirItem IN hb_ATokens( cDir, hb_ps() )
IF !( Right( cDirTemp, 1 ) == hb_ps() ) .AND. ! Empty( cDirTemp )
cDirTemp += hb_ps()
ENDIF
IF ! Empty( cDirItem ) /* Skip root path, if any */
cDirTemp += cDirItem
IF hb_FileExists( cDirTemp )
RETURN .F.
ELSEIF ! hb_DirExists( cDirTemp )
IF MakeDir( cDirTemp ) != 0
RETURN .F.
ENDIF
ENDIF
ENDIF
NEXT
ENDIF
RETURN .T.
STATIC FUNCTION DirAddPathSep( cDir )
IF ! Empty( cDir ) .AND. !( Right( cDir, 1 ) == hb_ps() )
cDir += hb_ps()
ENDIF
RETURN cDir
STATIC PROCEDURE mk_FCopyToDir( cSrc, cDstDir, l644 )
LOCAL cDir, cName, cExt
LOCAL cDst
hb_FNameSplit( cSrc,, @cName, @cExt )
hb_FNameSplit( cDstDir, @cDir )
cDst := hb_FNameMerge( cDir, cName, cExt )
IF hb_FCopy( cSrc, cDst ) == 0
IF l644
hb_FSetAttr( cDst, hb_bitOr( HB_FA_RUSR, HB_FA_WUSR, HB_FA_RGRP, HB_FA_ROTH ) )
ENDIF
ENDIF
RETURN
STATIC FUNCTION query_stdout( cName )
LOCAL cStdOut
hb_processRun( cName,, @cStdOut )
RETURN cStdOut
STATIC FUNCTION query_rpm( cName, cID )
LOCAL cResult := query_stdout( "rpm -q --queryformat='.%{VERSION}' " + cName )
RETURN iif( Empty( cResult ), "", cID + StrTran( cResult, "." ) )
/* Please add your distro suffix if it not belong to the one recognized below
and remember that order checking can be important */
STATIC FUNCTION unix_name()
LOCAL tmp
DO CASE
CASE GetEnv( "HB_PLATFORM" ) == "dos" ; RETURN "djgpp"
CASE GetEnv( "HB_PLATFORM" ) == "win" ; RETURN GetEnv( "HB_COMPILER" )
CASE ! Empty( tmp := query_rpm( "mandriva-release-One", "mdk" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "mandriva-release" , "mdk" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "mandrake-release" , "mdk" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "redhat-release" , "rh" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "fedora-release" , "fc" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "suse-release" , "sus" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "openSUSE-release" , "sus" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "conectiva-release" , "cl" ) ) ; RETURN tmp
CASE ! Empty( tmp := query_rpm( "aurox-release" , "cl" ) ) ; RETURN tmp
/* TODO: Rewrite this in Harbour */
CASE hb_FileExists( "/etc/pld-release" )
RETURN "" /* cat /etc/pld-release|sed -e '/1/ !d' -e 's/[^0-9]//g' -e 's/^/pld/'` */
ENDCASE
RETURN Lower( query_stdout( "uname -s" ) )

View File

@@ -6,15 +6,14 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE := 1
export HB_BIN_INSTALL := /usr/bin
export HB_LIB_INSTALL := /usr/lib/harbour
export HB_INC_INSTALL := /usr/include/harbour
export HB_DOC_INSTALL := /usr/share/doc/harbour
export HB_ETC_INSTALL := /etc/harbour
export HB_INST_PKGPREF := $(CURDIR)/debian/harbour
export HB_BIN_INSTALL := $(CURDIR)/debian/harbour/usr/bin
export HB_LIB_INSTALL := $(CURDIR)/debian/harbour/usr/lib/harbour
export HB_INC_INSTALL := $(CURDIR)/debian/harbour/usr/include/harbour
export HB_DOC_INSTALL := $(CURDIR)/debian/harbour/usr/share/doc/harbour
export HB_ETC_INSTALL := $(CURDIR)/debian/harbour/etc/harbour
# is INSTDIR necessary for dpkg? If not then please remove it.
export INSTDIR := $(HB_INST_PKGPREF)
export INSTDIR := $(CURDIR)/debian/harbour
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
HB_USER_CFLAGS += -O0
@@ -52,7 +51,7 @@ install: build
dh_installdirs
make install
install -m644 src/rtl/gtcrs/hb-charmap.def $(HB_INST_PKGPREF)$(HB_ETC_INSTALL)/hb-charmap.def
install -m644 src/rtl/gtcrs/hb-charmap.def $(HB_ETC_INSTALL)/hb-charmap.def
# Build architecture-independent files here.

View File

@@ -64,10 +64,11 @@
%define hb_sln export HB_WITH_SLANG=%{!?_without_slang:yes}%{?_without_slang:no}
%define hb_x11 export HB_WITH_X11=%{!?_without_x11:yes}%{?_without_x11:no}
%define hb_local export HB_WITH_ZLIB=%{?_with_localzlib:local} ; export HB_WITH_PCRE=%{?_with_localpcre:local}
%define hb_bdir export HB_BIN_INSTALL=%{_bindir}
%define hb_idir export HB_INC_INSTALL=%{_includedir}/%{name}
%define hb_ldir export HB_LIB_INSTALL=%{_libdir}/%{name}
%define hb_edir export HB_ETC_INSTALL=%{hb_etcdir}
%define hb_bdir export HB_BIN_INSTALL=${RPM_BUILD_ROOT}%{_bindir}
%define hb_idir export HB_INC_INSTALL=${RPM_BUILD_ROOT}%{_includedir}/%{name}
%define hb_ldir export HB_LIB_INSTALL=${RPM_BUILD_ROOT}%{_libdir}/%{name}
%define hb_edir export HB_ETC_INSTALL=${RPM_BUILD_ROOT}%{hb_etcdir}
%define hb_mdir export HB_MAN_INSTALL=${RPM_BUILD_ROOT}%{_mandir}
%define hb_cmrc export HB_BUILD_NOGPLLIB=%{?_without_gpllib:yes}
%define hb_ctrb export HB_BUILD_CONTRIBS="hbblink hbclipsm hbct hbgt hbmisc hbmzip hbnetio hbtip hbtpathy hbhpdf hbziparc hbfoxpro hbsms hbfship hbxpp xhb rddbmcdx rddsql sddsqlt3 hbnf %{?_with_allegro:gtalleg} %{?_with_cairo:hbcairo} %{?_with_cups:hbcups} %{?_with_curl:hbcurl} %{?_with_firebird:hbfbird sddfb} %{?_with_freeimage:hbfimage} %{?_with_gd:hbgd} %{?_with_mysql:hbmysql sddmy} %{?_with_odbc:hbodbc sddodbc} %{?_with_pgsql:hbpgsql sddpg} %{?_with_qt:hbqt hbxbp} %{?_with_ads:rddads}"
%define hb_env %{hb_plat} ; %{hb_cc} ; %{hb_cflag} ; %{hb_lflag} ; %{hb_dflag} ; %{shl_path} ; %{hb_gpm} ; %{hb_crs} ; %{hb_sln} ; %{hb_x11} ; %{hb_local} ; %{hb_bdir} ; %{hb_idir} ; %{hb_ldir} ; %{hb_edir} ; %{hb_ctrb} ; %{hb_cmrc}
@@ -407,34 +408,33 @@ make %{?_smp_mflags}
%{hb_env}
export HB_INST_PKGPREF=$RPM_BUILD_ROOT
export HB_BUILD_STRIP=all
export HB_BUILD_SHARED=%{!?_with_static:yes}
# necessary for shared linked hbrun used to execute postinst.prg
export LD_LIBRARY_PATH=$HB_INST_PKGPREF$HB_LIB_INSTALL
export LD_LIBRARY_PATH=$HB_LIB_INSTALL
make install %{?_smp_mflags}
[ "%{?_without_curses:1}" ] && rm -f $HB_INST_PKGPREF$HB_LIB_INSTALL/libgtcrs.a
[ "%{?_without_slang:1}" ] && rm -f $HB_INST_PKGPREF$HB_LIB_INSTALL/libgtsln.a
rm -f $HB_INST_PKGPREF$HB_LIB_INSTALL/libjpeg.a
rm -f $HB_INST_PKGPREF$HB_LIB_INSTALL/liblibhpdf.a
rm -f $HB_INST_PKGPREF$HB_LIB_INSTALL/libpng.a
rm -f $HB_INST_PKGPREF$HB_LIB_INSTALL/libsqlite3.a
[ "%{?_without_curses:1}" ] && rm -f $HB_LIB_INSTALL/libgtcrs.a
[ "%{?_without_slang:1}" ] && rm -f $HB_LIB_INSTALL/libgtsln.a
rm -f $HB_LIB_INSTALL/libjpeg.a
rm -f $HB_LIB_INSTALL/liblibhpdf.a
rm -f $HB_LIB_INSTALL/libpng.a
rm -f $HB_LIB_INSTALL/libsqlite3.a
mkdir -p $HB_INST_PKGPREF%{_mandir}/man1
install -m644 src/main/*.1* $HB_INST_PKGPREF%{_mandir}/man1/
install -m644 src/pp/*.1* $HB_INST_PKGPREF%{_mandir}/man1/
install -m644 utils/hbmk2/*.1* $HB_INST_PKGPREF%{_mandir}/man1/
install -m644 utils/hbrun/*.1* $HB_INST_PKGPREF%{_mandir}/man1/
install -m644 utils/hbtest/*.1* $HB_INST_PKGPREF%{_mandir}/man1/
mkdir -p $HB_MAN_INSTALL/man1
install -m644 src/main/*.1* $HB_MAN_INSTALL/man1/
install -m644 src/pp/*.1* $HB_MAN_INSTALL/man1/
install -m644 utils/hbmk2/*.1* $HB_MAN_INSTALL/man1/
install -m644 utils/hbrun/*.1* $HB_MAN_INSTALL/man1/
install -m644 utils/hbtest/*.1* $HB_MAN_INSTALL/man1/
mkdir -p $HB_INST_PKGPREF$HB_ETC_INSTALL
install -m644 src/rtl/gtcrs/hb-charmap.def $HB_INST_PKGPREF$HB_ETC_INSTALL/hb-charmap.def
mkdir -p $HB_ETC_INSTALL
install -m644 src/rtl/gtcrs/hb-charmap.def $HB_ETC_INSTALL/hb-charmap.def
# remove unused files
rm -f $HB_INST_PKGPREF$HB_BIN_INSTALL/hbtest
rm -f $HB_BIN_INSTALL/hbtest
# Create a README file for people using this RPM.
cat > doc/%{readme} <<EOF

View File

@@ -1,174 +0,0 @@
#!/bin/sh
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>
# simple script to build binaries .tgz from Harbour sources
#
# See COPYING for licensing terms.
# ---------------------------------------------------------------
cd `dirname $0`
. bin/hb-func.sh
name="harbour"
hb_ver=`get_hbver`
hb_verstat=`get_hbverstat`
hb_platform=`get_hbplatform`
[ "${hb_verstat}" = "" ] || hb_ver="${hb_ver}-${hb_verstat}"
[ "${hb_platform}" = "" ] || hb_platform="-${hb_platform}${HB_BUILDSUF}"
[ "${HB_XBUILD}" = "" ] || hb_platform="-${HB_XBUILD}"
hb_archfile="${name}-${hb_ver}${hb_platform}.bin.tar.gz"
hb_instfile="${name}-${hb_ver}${hb_platform}.inst.sh"
hb_pref="hb"
hb_sysdir="yes"
[ -z "$HB_INSTALL_PREFIX" ] && [ -n "$PREFIX" ] && export HB_INSTALL_PREFIX="$PREFIX"
if [ -z "$TMPDIR" ]; then TMPDIR="/tmp"; fi
HB_INST_PKGPREF="$TMPDIR/$name.bin.$USER.$$"
if [ -z "$HB_PLATFORM" ]; then
if [ "$OSTYPE" = "msdosdjgpp" ]; then
hb_plat="dos"
else
hb_plat=`uname -s | tr -d "[-]" | tr '[A-Z]' '[a-z]' 2>/dev/null`
case "$hb_plat" in
*windows*|*mingw32*|msys*) hb_plat="win" ;;
*os/2*) hb_plat="os2" ;;
*dos) hb_plat="dos" ;;
*bsd) hb_plat="bsd" ;;
esac
fi
export HB_PLATFORM="$hb_plat"
fi
ETC="/etc"
# Select the platform-specific installation prefix and ownership
HB_INSTALL_OWNER="root"
HB_INSTALL_GROUP="root"
case "$HB_PLATFORM" in
darwin)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP="wheel"
ETC="/private/etc"
;;
bsd)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP="wheel"
;;
linux)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
;;
sunos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/opt"
;;
haiku)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/boot/common"
;;
win)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP="0"
hb_sysdir="no"
hb_instfile=""
;;
dos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/${name}"
hb_sysdir="no"
hb_instfile=""
hb_archfile="${name}.tgz"
HB_INST_PKGPREF="$TMPDIR/hb-$$"
;;
*)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
;;
esac
export HB_INST_PKGPREF
# Select the platform-specific command names
MAKE=make
TAR=tar
hb_gnutar=yes
if gtar --version >/dev/null 2>&1; then
TAR=gtar
elif ! tar --version >/dev/null 2>&1; then
hb_gnutar=no
echo "Warning!!! Cannot find GNU TAR"
else
# tar is mapped to bsdtar starting OS X 10.6
case `tar --version` in
*bsdtar*) hb_gnutar=no ;;
esac
fi
if gmake --version >/dev/null 2>&1; then
MAKE=gmake
elif ! make --version >/dev/null 2>&1; then
echo "Warning!!! Cannot find GNU MAKE"
fi
# build
umask 022
$MAKE clean "$@" || exit
$MAKE "$@" || exit
# install
rm -fR "${HB_INST_PKGPREF}"
$MAKE install "$@" || exit
if [ "${hb_sysdir}" = "yes" ]; then
mkdir -p $HB_INST_PKGPREF$ETC/harbour
cp -f src/rtl/gtcrs/hb-charmap.def $HB_INST_PKGPREF$ETC/harbour/hb-charmap.def
chmod 644 $HB_INST_PKGPREF$ETC/harbour/hb-charmap.def
fi
CURDIR=$(pwd)
if [ $hb_gnutar = yes ]; then
(cd "${HB_INST_PKGPREF}"; $TAR czvf "${CURDIR}/${hb_archfile}" --owner=${HB_INSTALL_OWNER} --group=${HB_INSTALL_GROUP} .)
UNTAR_OPT=xvpf
elif [ $TAR = bsdtar ]; then
(cd "${HB_INST_PKGPREF}"; $TAR czvf "${CURDIR}/${hb_archfile}" .)
UNTAR_OPT=xvpf
else
(cd "${HB_INST_PKGPREF}"; $TAR covf - . | gzip > "${CURDIR}/${hb_archfile}")
UNTAR_OPT=xvf
fi
rm -fR "${HB_INST_PKGPREF}"
if [ -n "${hb_instfile}" ]; then
if [ "${HB_PLATFORM}" = linux ]; then
DO_LDCONFIG="&& ldconfig"
else
DO_LDCONFIG=""
fi
# In the generated script use tar instead of $TAR because we can't be sure
# if $TAR exists in the installation environment
size=`wc -c "${hb_archfile}"|(read size file; echo $size)`
cat > "${hb_instfile}" <<EOF
#!/bin/sh
[ "\$BASH" ] || exec bash \`which \$0\` \${1+"\$@"}
if [ "\$1" = "--extract" ]; then
tail -c $size "\$0" > "${hb_archfile}"
exit
fi
if [ \`id -u\` != 0 ]; then
echo "This package has to be installed from root account."
exit 1
fi
echo "Do you want to install ${name} (y/n)"
read ASK
if [ "\${ASK}" != "y" ] && [ "\${ASK}" != "Y" ]; then
exit 1
fi
(tail -c $size "\$0" | gzip -cd | (cd /;tar ${UNTAR_OPT} -)) ${DO_LDCONFIG}
exit \$?
HB_INST_EOF
EOF
cat "${hb_archfile}" >> "${hb_instfile}"
chmod +x "${hb_instfile}"
rm -f "${hb_archfile}"
fi

View File

@@ -16,15 +16,8 @@ PRG_MAIN := hbrun.prg
LIBS = hbcplr hbpp hbcommon $(HB_LIBS_MT_RDD)
ifeq ($(_DEFAULT_INC_DIR),)
ifneq ($(HB_INC_INSTALL),)
ifneq ($(HB_INST_PKGPREF),)
_DEFAULT_INC_DIR := $(HB_INC_INSTALL)
endif
endif
endif
ifneq ($(_DEFAULT_INC_DIR),)
HB_PRGFLAGS += -D_DEFAULT_INC_DIR=[$(_DEFAULT_INC_DIR)]
ifneq ($(HB_INC_INSTALL),)
HB_PRGFLAGS += -D_HBRUN_HB_INC_INSTALL=[$(HB_INC_INSTALL)]
endif
include $(TOP)$(ROOT)config/bin.mk

View File

@@ -19,3 +19,5 @@ hbrun.prg
-icon={allwin}../../package/harb_win.ico
-icon={os2}../../package/harb_os2.ico
{HB_INC_INSTALL}"-prgflag=-D_HBRUN_HB_INC_INSTALL=${HB_INC_INSTALL}"

View File

@@ -84,15 +84,23 @@ STATIC s_lWasLoad := .F.
/* ********************************************************************** */
PROCEDURE _APPMAIN( cFile, ... )
LOCAL cPath, cExt
LOCAL cPath, cDir, cExt
#ifdef _DEFAULT_INC_DIR
AADD( s_aIncDir, "-I" + _DEFAULT_INC_DIR )
#ifdef _HBRUN_HB_INC_INSTALL
cPath := _HBRUN_HB_INC_INSTALL
hb_FNameSplit( cPath, @cDir )
IF ! Empty( cDir ) .AND. Left( cDir, 1 ) $ hb_osPathDelimiters()
AADD( s_aIncDir, "-I" + cPath )
ENDIF
#else
HB_SYMBOL_UNUSED( cExt )
#endif
cPath := getenv( "HB_INC_INSTALL" )
IF !EMPTY( cPath )
AADD( s_aIncDir, "-I" + cPath )
ENDIF
#ifdef __PLATFORM__UNIX
AADD( s_aIncDir, "-I/usr/include/harbour" )
AADD( s_aIncDir, "-I/usr/local/include/harbour" )