2009-10-06 16:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/config/instsh.mk
  * harbour/bin/hb-func.sh
  * harbour/bin/postinst.sh
    + added support for HB_INST_PKGPREF which can be used as package
      temporary install directory

  * harbour/mpkg_tgz.sh
    ! use HB_INST_PKGPREF to allow creating install packages without
      special user rights and to protect against damaging original system
      installation during package building if sufficient user rights were
      guarantied
This commit is contained in:
Przemyslaw Czerpak
2009-10-06 14:46:46 +00:00
parent c03ae600b4
commit 9d46e88fef
5 changed files with 65 additions and 44 deletions

View File

@@ -17,6 +17,19 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-10-06 16:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/config/instsh.mk
* harbour/bin/hb-func.sh
* harbour/bin/postinst.sh
+ added support for HB_INST_PKGPREF which can be used as package
temporary install directory
* harbour/mpkg_tgz.sh
! use HB_INST_PKGPREF to allow creating install packages without
special user rights and to protect against damaging original system
installation during package building if sufficient user rights were
guarantied
2009-10-06 14:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
+ harbour/tests/cpinfo.prg
* modified to show more precise information about code page definition

View File

@@ -785,7 +785,7 @@ mk_hblibso()
hb_libs=`mk_hbgetlibs "$2"`
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
(cd $HB_LIB_INSTALL
(cd ${HB_INST_PKGPREF}${HB_LIB_INSTALL}
LIBS=""
LIBSMT=""
gpm="${HB_HAS_GPM}"
@@ -892,7 +892,7 @@ mk_hblibso()
fi
full_lib_name="${lib_pref}${name}${lib_suff}"
full_lib_name_mt="${lib_pref}${name}mt${lib_suff}"
hb_mkdyn="${HB_BIN_INSTALL}/${HB_TOOLS_PREF-hb}-mkdyn"
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/${HB_TOOLS_PREF-hb}-mkdyn"
# echo "Making ${full_lib_name}..."
# ${hb_mkdyn} ${full_lib_name} ${LIBS} ${linker_options}
# if [ "${LIBS}" != "${LIBSMT}" ]; then
@@ -909,8 +909,8 @@ mk_hblibso()
[ "${HB_PLATFORM}" = "wce" ]; then
if [ "${HB_PLATFORM}" = "${HB_HOST_PLAT}" ]; then
(cd "$dir"
mv "${HB_LIB_INSTALL}/$l" "${HB_BIN_INSTALL}"
mv "${HB_LIB_INSTALL}/$ll" "${HB_BIN_INSTALL}")
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
@@ -928,5 +928,5 @@ mk_hblibso()
fi
done
)
#export LD_LIBRARY_PATH="$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
#export LD_LIBRARY_PATH="${HB_INST_PKGPREF}$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
}

View File

@@ -40,7 +40,7 @@ fi
. ${hb_root}/bin/hb-func.sh
# chmod 644 $HB_INC_INSTALL/*
# chmod 644 ${HB_INST_PKGPREF}${HB_INC_INSTALL}/*
if [ "$HB_COMPILER" = "gcc" ] || \
[ "$HB_COMPILER" = "mingw" ] || \
@@ -52,7 +52,7 @@ if [ "$HB_COMPILER" = "gcc" ] || \
[ "$HB_COMPILER" = "sunpro" ]
then
if [ -n "${HB_TOOLS_PREF}" ]; then
hb_mkdyn="${HB_BIN_INSTALL}/${HB_TOOLS_PREF}-mkdyn"
hb_mkdyn="${HB_INST_PKGPREF}${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" \
@@ -60,12 +60,12 @@ then
"${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \
chmod 755 "${hb_mkdyn}"
elif [ "$HB_COMPILER" = "icc" ]; then
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_INST_PKGPREF}${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_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn"
rm -f "${hb_mkdyn}"
lnopt=""
[ "$HB_BUILD_OPTIM" = "no" ] || lnopt="-fast -xnolibmopt $lnopt"
@@ -75,12 +75,12 @@ then
elif [ "${HB_PLATFORM}" = "sunos" ] || \
[ "${HB_PLATFORM}" = "hpux" ] || \
! which install &>/dev/null; then
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_INST_PKGPREF}${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_BIN_INSTALL}/hb-mkdyn"
hb_mkdyn="${HB_INST_PKGPREF}${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
@@ -88,11 +88,11 @@ then
# Compatibility hb-mkslib creation. Please use hb-mkdyn instead.
if [ -n "${hb_mkdyn}" ] && [ -f "${hb_mkdyn}" ]; then
hb_mkdyn="${HB_TOOLS_PREF-hb}-mkslib"
(cd "${HB_BIN_INSTALL}" && rm -f "${hb_mkdyn}" && \
(cd "${HB_INST_PKGPREF}${HB_BIN_INSTALL}" && rm -f "${hb_mkdyn}" && \
ln -s "${HB_TOOLS_PREF-hb}-mkdyn" "${hb_mkdyn}")
fi
mk_hbtools "${HB_BIN_INSTALL}" "$@"
mk_hbtools "${HB_INST_PKGPREF}${HB_BIN_INSTALL}" "$@"
if [ "${HB_PLATFORM}" != "dos" ]; then
mk_hblibso "${hb_root}"

View File

@@ -18,25 +18,27 @@ ifeq ($(realpath $(INSTALL_DIR)),$(realpath .))
else
ifneq ($(HB_SHELL),sh)
INSTALL_DIR_OS := $(subst /,\,$(INSTALL_DIR))
INSTALL_DIR_OS := $(subst /,\,$(HB_INST_PKGPREF)$(INSTALL_DIR))
INSTALL_FILES_OS := $(subst /,\,$(INSTALL_FILES))
else
INSTALL_DIR_OS := $(subst \,/,$(HB_INST_PKGPREF)$(INSTALL_DIR))
endif
ifeq ($(HB_SHELL),sh)
INSTALL_RULE := \
@$(MDP) $(subst \,/,$(INSTALL_DIR)); \
if [ ! -d "$(subst \,/,$(INSTALL_DIR))" ]; \
@$(MDP) $(INSTALL_DIR_OS); \
if [ ! -d "$(INSTALL_DIR_OS)" ]; \
then \
$(ECHO) "! Can't install, path not found: '$(subst \,/,$(INSTALL_DIR))'" 1>&2; \
$(ECHO) "! Can't install, path not found: '$(INSTALL_DIR_OS)'" 1>&2; \
false; \
else \
for i in $(INSTALL_FILES); \
do \
if [ -r "$$i" ]; \
then \
$(ECHO) "! Installing $$i on $(subst \,/,$(INSTALL_DIR))"; \
$(CP) $$i $(subst \,/,$(INSTALL_DIR)); \
$(ECHO) "! Installing $$i on $(INSTALL_DIR_OS)"; \
$(CP) $$i $(INSTALL_DIR_OS); \
true; \
else \
$(ECHO) "! Can't install $$i, not found" 1>&2; \
@@ -60,14 +62,14 @@ endif
ifeq ($(HB_SHELL),os2)
define inst_file_all
-@$(MDP) $(INSTALL_DIR)
-@$(MDP) $(INSTALL_DIR_OS)
$(foreach file,$(INSTALL_FILES),$(inst_file))
endef
# NOTE: The empty line directly before 'endef' HAVE TO exist!
# It causes that every command will be separated by LF
define inst_file
-@$(CP) $(file) $(INSTALL_DIR)
-@$(CP) $(file) $(INSTALL_DIR_OS)
endef

View File

@@ -30,7 +30,7 @@ hb_sysdir="yes"
[ -z "$HB_INSTALL_PREFIX" ] && [ -n "$PREFIX" ] && export HB_INSTALL_PREFIX="$PREFIX"
if [ -z "$TMPDIR" ]; then TMPDIR="/tmp"; fi
HB_INST_PREF="$TMPDIR/$name.bin.$USER.$$"
HB_INST_PKGPREF="$TMPDIR/$name.bin.$USER.$$"
if [ -z "$HB_PLATFORM" ]; then
if [ "$OSTYPE" = "msdosdjgpp" ]; then
@@ -50,41 +50,47 @@ fi
ETC="/etc"
# Select the platform-specific installation prefix and ownership
HB_INSTALL_OWNER=root
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
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"
HB_INSTALL_GROUP=root
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
;;
sunos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr"
HB_INSTALL_GROUP=root
[ -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_INSTALL_GROUP="0"
hb_sysdir="no"
hb_instfile=""
;;
dos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/${name}"
HB_INSTALL_GROUP=root
hb_sysdir="no"
hb_instfile=""
hb_archfile="${name}.tgz"
HB_INST_PREF="$TMPDIR/hb-$$"
HB_INST_PKGPREF="$TMPDIR/hb-$$"
;;
*)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP=wheel
;;
esac
export HB_INST_PKGPREF
# Select the platform-specific command names
MAKE=make
TAR=tar
@@ -103,21 +109,21 @@ fi
# build
umask 022
$MAKE clean
$MAKE
$MAKE clean "$@" || exit
$MAKE "$@" || exit
# install
rm -fR "${HB_INST_PREF}"
$MAKE -i install
rm -fR "${HB_INST_PKGPREF}"
$MAKE install "$@" || exit
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_PKGPREF$ETC/harbour
cp -f source/rtl/gtcrs/hb-charmap.def $HB_INST_PKGPREF$ETC/harbour/hb-charmap.def
chmod 644 $HB_INST_PKGPREF$ETC/harbour/hb-charmap.def
cat > $HB_INST_PREF$ETC/harbour.cfg <<EOF
cat > $HB_INST_PKGPREF$ETC/harbour.cfg <<EOF
CC=${HB_CCPREFIX}gcc
CFLAGS=-c -I$_DEFAULT_INC_DIR
CFLAGS=-c -I${HB_INSTALL_PREFIX}/include/harbour
VERBOSE=YES
DELTMP=YES
EOF
@@ -126,13 +132,13 @@ fi
CURDIR=$(pwd)
if [ $hb_gnutar = yes ]; then
(cd "${HB_INST_PREF}"; $TAR czvf "${CURDIR}/${hb_archfile}" --owner=${HB_INSTALL_OWNER} --group=${HB_INSTALL_GROUP} .)
(cd "${HB_INST_PKGPREF}"; $TAR czvf "${CURDIR}/${hb_archfile}" --owner=${HB_INSTALL_OWNER} --group=${HB_INSTALL_GROUP} .)
UNTAR_OPT=xvpf
else
(cd "${HB_INST_PREF}"; $TAR covf - . | gzip > "${CURDIR}/${hb_archfile}")
(cd "${HB_INST_PKGPREF}"; $TAR covf - . | gzip > "${CURDIR}/${hb_archfile}")
UNTAR_OPT=xvf
fi
rm -fR "${HB_INST_PREF}"
rm -fR "${HB_INST_PKGPREF}"
if [ -n "${hb_instfile}" ]; then