2009-09-19 20:17 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* mpkg_tgz.sh
  * bin/postinst.sh
    % Attempt to clean mpkg_tgz.sh from redundant make logic.
      Some tasks (stripping, shared tool making using HB_BUILD_SHARED,
      chmod on HB_INC_INSTALL) moved to postinst.sh, some others
      deleted (platform detection, shared tool building using old
      method, component detections, install dir forming and creation.
    ; Please review me and test.
    ; TODO: Maybe above tasks in postinst.sh should only be
            executed when HB_BUILD_PKG=yes.

  * config/global.mk
    ! Fixed to only use lib64 dir if it exists. Please review/test
      this feature.
    + Now exports HB_SYSLOC variable which is set to non-empty if
      HB_INSTALL_PREFIX points to system location.

  * harbour.spec
    - Deleted PIC option related lines. These are handled by GNU Make now.

  * utils/hbmk2/hbmk2.prg
    + Added PIC related options to *nix compilers when using -hbdyn option.
    % Deleted PIC related option from link command. Not needed.
This commit is contained in:
Viktor Szakats
2009-09-19 18:18:17 +00:00
parent 72a381acc1
commit 48018d9896
6 changed files with 85 additions and 185 deletions

View File

@@ -17,6 +17,31 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-09-19 20:17 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* mpkg_tgz.sh
* bin/postinst.sh
% Attempt to clean mpkg_tgz.sh from redundant make logic.
Some tasks (stripping, shared tool making using HB_BUILD_SHARED,
chmod on HB_INC_INSTALL) moved to postinst.sh, some others
deleted (platform detection, shared tool building using old
method, component detections, install dir forming and creation.
; Please review me and test.
; TODO: Maybe above tasks in postinst.sh should only be
executed when HB_BUILD_PKG=yes.
* config/global.mk
! Fixed to only use lib64 dir if it exists. Please review/test
this feature.
+ Now exports HB_SYSLOC variable which is set to non-empty if
HB_INSTALL_PREFIX points to system location.
* harbour.spec
- Deleted PIC option related lines. These are handled by GNU Make now.
* utils/hbmk2/hbmk2.prg
+ Added PIC related options to *nix compilers when using -hbdyn option.
% Deleted PIC related option from link command. Not needed.
2009-09-19 18:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
* config/global.mk

View File

@@ -40,6 +40,29 @@ fi
. ${hb_root}/bin/hb-func.sh
# Keep the size of the binaries to a minimim.
if [ -f $HB_BIN_INSTALL/harbour${hb_exesuf} ]; then
${HB_CCPREFIX}strip $HB_BIN_INSTALL/harbour${hb_exesuf}
fi
if [ "$HB_PLATFORM" != "hpux" ]; then
# Keep the size of the libraries to a minimim, but don't try to strip symlinks.
${HB_CCPREFIX}strip -S `find $HB_LIB_INSTALL -type f`
fi
# check if we should rebuild tools with shared libs
if [ "${HB_SYSLOC}" = yes ]
then
for utl in hbmk2 hbrun hbi18n hbformat hbtest
do
(cd "utils/${utl}"
rm -fR "./${HB_PLATFORM}/${HB_COMPILER}/${utl}${hb_exesuf}"
$MAKE install HB_BUILD_SHARED=yes
${HB_CCPREFIX}strip "${HB_BIN_INSTALL}/${utl}${hb_exesuf}")
done
fi
chmod 644 $HB_INC_INSTALL/*
if [ "$HB_COMPILER" = "gcc" ] || \
[ "$HB_COMPILER" = "mingw" ] || \
[ "$HB_COMPILER" = "mingw64" ] || \

View File

@@ -1196,16 +1196,22 @@ ifeq ($(HB_INIT_DONE),)
endif
endif
HB_SYSLOC :=
ifneq ($(findstring |/usr/local/bin,|$(HB_INSTALL_PREFIX)),)
HB_SYSLOC := yes
else ifneq ($(findstring |/usr/bin,|$(HB_INSTALL_PREFIX)),)
HB_SYSLOC := yes
else ifneq ($(findstring |/opt/harbour,|$(HB_INSTALL_PREFIX)),)
HB_SYSLOC := yes
else ifneq ($(findstring |/opt/bin,|$(HB_INSTALL_PREFIX)),)
HB_SYSLOC := yes
endif
export HB_SYSLOC
ifneq ($(HB_INSTALL_PREFIX),)
ifeq ($(HB_BUILD_SHARED),)
ifneq ($(findstring |/usr/local/bin,|$(HB_INSTALL_PREFIX)),)
export HB_BUILD_SHARED := yes
else ifneq ($(findstring |/usr/bin,|$(HB_INSTALL_PREFIX)),)
export HB_BUILD_SHARED := yes
else ifneq ($(findstring |/opt/harbour,|$(HB_INSTALL_PREFIX)),)
export HB_BUILD_SHARED := yes
else ifneq ($(findstring |/opt/bin,|$(HB_INSTALL_PREFIX)),)
ifeq ($(HB_SYSLOC),yes)
export HB_BUILD_SHARED := yes
endif
endif
@@ -1228,9 +1234,11 @@ ifneq ($(HB_INSTALL_PREFIX),)
INCPOSTFIX := $(DIRSEP)harbour
endif
endif
# Use 'lib64' instead of 'lib' for 64-bit targets
ifneq ($(filter $(HB_CPU),x86_64),)
LIBPOSTFIX := 64$(LIBPOSTFIX)
# Use 'lib64' instead of 'lib' for 64-bit targets where lib64 dir exists
ifneq ($(wildcard $(HB_INSTALL_PREFIX)$(DIRSEP)lib64),)
ifneq ($(filter $(HB_CPU),x86_64),)
LIBPOSTFIX := 64$(LIBPOSTFIX)
endif
endif
endif

View File

@@ -379,11 +379,6 @@ rm -rf $RPM_BUILD_ROOT
%build
%{hb_env}
case "`uname -m`" in
*[_@]64)
export HB_USER_CFLAGS="$HB_USER_CFLAGS -fPIC"
;;
esac
make %{?_smp_mflags}
@@ -396,11 +391,6 @@ make %{?_smp_mflags}
# Install harbour itself.
%{hb_env}
case "`uname -m`" in
*[_@]64)
export HB_USER_CFLAGS="$HB_USER_CFLAGS -fPIC"
;;
esac
export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL
export _DEFAULT_INC_DIR=$HB_INC_INSTALL

View File

@@ -24,11 +24,8 @@ hb_platform=`get_hbplatform`
hb_archfile="${name}-${hb_ver}${hb_platform}.bin.tar.gz"
# disabled self extracting shell envelop
hb_instfile="${name}-${hb_ver}${hb_platform}.inst.sh"
hb_lnkso="yes"
hb_pref="hb"
hb_contrib=""
hb_sysdir="yes"
hb_exesuf=""
[ -z "$HB_INSTALL_PREFIX" ] && [ -n "$PREFIX" ] && export HB_INSTALL_PREFIX="$PREFIX"
@@ -50,35 +47,8 @@ if [ -z "$HB_PLATFORM" ]; then
export HB_PLATFORM="$hb_plat"
fi
if [ -z "$HB_COMPILER" ]; then
case "$HB_PLATFORM" in
win) HB_COMPILER="mingw" ;;
dos) HB_COMPILER="djgpp" ;;
*) HB_COMPILER="gcc" ;;
esac
export HB_COMPILER
fi
if [ -z "$HB_COMMERCE" ]; then export HB_COMMERCE=no; fi
# default lib dir name
HB_LIBDIRNAME="lib"
ETC="/etc"
HB_ARCH64=""
if [ "$HB_PLATFORM" = "linux" ]
then
HB_CPU=`uname -m`
case "$HB_CPU" in
*[_@]64)
HB_ARCH64="yes"
;;
*)
;;
esac
fi
# Select the platform-specific installation prefix and ownership
HB_INSTALL_OWNER=root
case "$HB_PLATFORM" in
@@ -86,31 +56,25 @@ case "$HB_PLATFORM" in
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP=wheel
ETC="/private/etc"
hb_lnkso="no"
;;
linux)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr"
[ -d "$HB_INSTALL_PREFIX/lib64" ] && [ "${HB_ARCH64}" = yes ] && HB_LIBDIRNAME="lib64"
HB_INSTALL_GROUP=root
;;
sunos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr"
[ -d "$HB_INSTALL_PREFIX/lib64" ] && [ "${HB_ARCH64}" = yes ] && HB_LIBDIRNAME="lib64"
HB_INSTALL_GROUP=root
;;
win)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP=0
hb_sysdir="no"
hb_exesuf=".exe"
hb_instfile=""
;;
dos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/${name}"
HB_INSTALL_GROUP=root
hb_lnkso="no"
hb_sysdir="no"
hb_exesuf=".exe"
hb_instfile=""
hb_archfile="${name}.tgz"
HB_INST_PREF="$TMPDIR/hb-$$"
@@ -137,110 +101,21 @@ elif ! make --version >/dev/null 2>&1; then
echo "Warning!!! Cannot find GNU MAKE"
fi
# Set other platform-specific build options
if [ -z "$HB_INC_GPM" ]; then
if [ "$HB_PLATFORM" = "linux" ] && \
( [ -f /usr/include/gpm.h ] || [ -f /usr/local/include/gpm.h ]); then
HB_INC_GPM=yes
else
HB_INC_GPM=no
fi
export HB_INC_GPM
fi
if [ -z "${HB_INC_SLANG}" ]; then
HB_INC_SLANG=yes
case "$HB_PLATFORM" in
linux|bsd|darwin|hpux|sunos)
for dir in /usr /usr/local /sw /opt/local
do
if [ -f ${dir}/include/slang.h ] || \
[ -f ${dir}/include/slang/slang.h ]; then
HB_INC_SLANG=no
fi
done
;;
esac
export HB_INC_SLANG
fi
case "$HB_PLATFORM" in
linux)
;;
darwin)
[ -z "$HB_INC_X11" ] && export HB_INC_X11=no
;;
dos|win)
[ -z "$HB_INC_X11" ] && export HB_INC_X11=no
;;
*)
[ -z "$HB_INC_X11" ] && export HB_INC_X11=no
;;
esac
if [ "$HB_COMMERCE" = yes ]
then
export HB_INC_GPM=no
export HB_INC_SLANG=no
fi
if [ "${hb_sysdir}" = "yes" ]; then
export HB_BIN_INSTALL="$HB_INSTALL_PREFIX/bin"
export HB_INC_INSTALL="$HB_INSTALL_PREFIX/include/${name}"
export HB_LIB_INSTALL="$HB_INSTALL_PREFIX/$HB_LIBDIRNAME/${name}"
else
export HB_BIN_INSTALL="$HB_INSTALL_PREFIX/bin"
export HB_INC_INSTALL="$HB_INSTALL_PREFIX/include"
export HB_LIB_INSTALL="$HB_INSTALL_PREFIX/$HB_LIBDIRNAME"
fi
# build
umask 022
$MAKE clean
$MAKE
for l in ${hb_contrib}
do
(cd "contrib/$l"
$MAKE clean
$MAKE )
done
# install
rm -fR "${HB_INST_PREF}"
export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL
export _DEFAULT_INC_DIR=$HB_INC_INSTALL
export _DEFAULT_LIB_DIR=$HB_LIB_INSTALL
export HB_BIN_INSTALL="$HB_INST_PREF$HB_BIN_INSTALL"
export HB_INC_INSTALL="$HB_INST_PREF$HB_INC_INSTALL"
export HB_LIB_INSTALL="$HB_INST_PREF$HB_LIB_INSTALL"
mkdir -p $HB_BIN_INSTALL
mkdir -p $HB_INC_INSTALL
mkdir -p $HB_LIB_INSTALL
$MAKE -i install
for l in ${hb_contrib}
do
(cd "contrib/$l"
$MAKE -i install)
done
# Keep the size of the binaries to a minimim.
if [ -f $HB_BIN_INSTALL/harbour${hb_exesuf} ]; then
${HB_CCPREFIX}strip $HB_BIN_INSTALL/harbour${hb_exesuf}
fi
if [ "$HB_PLATFORM" != "hpux" ]; then
# Keep the size of the libraries to a minimim, but don't try to strip symlinks.
${HB_CCPREFIX}strip -S `find $HB_LIB_INSTALL -type f`
fi
if [ "${hb_sysdir}" = "yes" ]; then
mkdir -p $HB_INST_PREF$ETC/harbour
cp -f source/rtl/gtcrs/hb-charmap.def $HB_INST_PREF$ETC/harbour/hb-charmap.def
chmod 644 $HB_INST_PREF$ETC/harbour/hb-charmap.def
mkdir -p $HB_INST_PREF$ETC/harbour
cp -f source/rtl/gtcrs/hb-charmap.def $HB_INST_PREF$ETC/harbour/hb-charmap.def
chmod 644 $HB_INST_PREF$ETC/harbour/hb-charmap.def
cat > $HB_INST_PREF$ETC/harbour.cfg <<EOF
cat > $HB_INST_PREF$ETC/harbour.cfg <<EOF
CC=${HB_CCPREFIX}gcc
CFLAGS=-c -I$_DEFAULT_INC_DIR
VERBOSE=YES
@@ -249,33 +124,6 @@ EOF
fi
# check if we should rebuild tools with shared libs
if [ "${hb_lnkso}" = yes ]
then
case $HB_PLATFORM in
darwin) ADD_LIBS="$ADD_LIBS -lncurses -L/opt/local/lib -L/sw/lib" ;;
dos|win) ADD_LIBS="" ;;
sunos) ADD_LIBS="$ADD_LIBS -lcurses" ;;
*) ADD_LIBS="$ADD_LIBS -lncurses" ;;
esac
[ "${HB_INC_GPM}" != no ] && ADD_LIBS="$ADD_LIBS -lgpm"
[ "${HB_INC_SLANG}" != no ] && ADD_LIBS="$ADD_LIBS -lslang"
[ "${HB_INC_X11}" != no ] && ADD_LIBS="$ADD_LIBS -L/usr/X11R6/$HB_LIBDIRNAME -lX11"
export HB_USER_LDFLAGS="-L${HB_LIB_INSTALL} -l${name} ${ADD_LIBS} ${HB_USER_LDFLAGS}"
export HB_USER_PRGFLAGS="\"-D_DEFAULT_INC_DIR='${_DEFAULT_INC_DIR}'\" ${HB_USER_PRGFLAGS}"
for utl in hbmk2 hbrun hbi18n hbformat hbtest
do
(cd "utils/${utl}"
rm -fR "./${HB_PLATFORM}/${HB_COMPILER}"
$MAKE install
${HB_CCPREFIX}strip "${HB_BIN_INSTALL}/${utl}${hb_exesuf}")
done
fi
chmod 644 $HB_INC_INSTALL/*
CURDIR=$(pwd)
if [ $hb_gnutar = yes ]; then
(cd "${HB_INST_PREF}"; $TAR czvf "${CURDIR}/${hb_archfile}" --owner=${HB_INSTALL_OWNER} --group=${HB_INSTALL_GROUP} .)

View File

@@ -1958,7 +1958,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
/* NOTE: We only use different shared object flags when compiling for
"( win || wce ) & !( allmingw | cygwin )". This may change in the future.
IMPORTANT: Keep this condition in sync with setting -DHB_DYNLIB C compiler flag */
IF lCreateDyn .AND. hbmk[ _HBMK_cPLAT ] $ "win|wce" .AND. !( hbmk[ _HBMK_cCOMP ] $ "mingw|mingw64|mingwarm|cygwin" )
IF lCreateDyn .AND. !( hbmk[ _HBMK_cCOMP ] $ "mingw|mingw64|mingwarm|cygwin" )
DEFAULT cWorkDir TO FN_DirGet( l_cPROGNAME ) + _WORKDIR_DEF_ + hb_osPathSeparator() + "hbdyn"
ELSE
DEFAULT cWorkDir TO FN_DirGet( l_cPROGNAME ) + _WORKDIR_DEF_
@@ -2132,7 +2132,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
cOpt_CompC += " {LC}"
ENDIF
cBin_Dyn := cBin_CompC
cOpt_Dyn := "-shared -fPIC {FD} -o {OD} {DL} {LO} {LS}"
cOpt_Dyn := "-shared {FD} -o {OD} {DL} {LO} {LS}"
cBin_Link := cBin_CompC
cOpt_Link := "{LO} {LA} {FL} {DL}"
cLibPathPrefix := "-L"
@@ -2189,6 +2189,14 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
ENDIF
ENDIF
IF lCreateDyn .AND. !( hbmk[ _HBMK_cPLAT ] == "darwin" )
IF hbmk[ _HBMK_cPLAT ] $ "hpux|sunos"
AAdd( hbmk[ _HBMK_aOPTC ], "-fPIC" )
ELSE
AAdd( hbmk[ _HBMK_aOPTC ], "-fpic" )
ENDIF
ENDIF
/* Always inherit/reproduce some flags from self */
IF "-mlp64" $ cSelfFlagC ; AAddNew( hbmk[ _HBMK_aOPTC ], "-mlp64" )
@@ -2197,12 +2205,6 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
ELSEIF "-m32" $ cSelfFlagC ; AAddNew( hbmk[ _HBMK_aOPTC ], "-m32" )
ENDIF
IF "-fPIC" $ cSelfFlagC ; AAddNew( hbmk[ _HBMK_aOPTC ], "-fPIC" )
ELSEIF "-fpic" $ cSelfFlagC ; AAddNew( hbmk[ _HBMK_aOPTC ], "-fpic" )
ELSEIF hbmk[ _HBMK_cPLAT ] == "sunos|hpux"
AAddNew( hbmk[ _HBMK_aOPTC ], "-fPIC" )
ENDIF
/* Add system libraries */
IF ! hbmk[ _HBMK_lSHARED ]
IF !( hbmk[ _HBMK_cPLAT ] == "beos" )
@@ -3010,6 +3012,10 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
AAdd( hbmk[ _HBMK_aOPTL ], "-o {OE}" )
ENDIF
IF lCreateDyn
AAdd( hbmk[ _HBMK_aOPTC ], "-KPIC" )
ENDIF
/* Add system libraries */
IF ! hbmk[ _HBMK_lSHARED ]
AAdd( l_aLIBSYS, "m" )
@@ -3062,7 +3068,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
/* NOTE: We only use different shared object flags when compiling for
"( win || wce ) & !( allmingw | cygwin )". This may change in the future.
IMPORTANT: Keep this condition in sync with workdir default settings */
IF lCreateDyn .AND. hbmk[ _HBMK_cPLAT ] $ "win|wce" .AND. !( hbmk[ _HBMK_cCOMP ] $ "mingw|mingw64|mingwarm|cygwin" )
IF lCreateDyn .AND. !( hbmk[ _HBMK_cCOMP ] $ "mingw|mingw64|mingwarm|cygwin" )
IF hbmk[ _HBMK_nHBMODE ] == _HBMODE_XHB .OR. ;
hbmk[ _HBMK_nHBMODE ] == _HBMODE_HB10
AAdd( hbmk[ _HBMK_aOPTC ], "-D__EXPORT__" )