* common.mak
* harbour-wce-spec
* harbour-win-spec
* harbour.spec
* make_b32.bat
* make_b32.mak
* make_gcc.mak
* make_gcc.sh
* make_gnu.bat
* make_gnu.sh
* make_gnu_os2.cmd
* make_gnu_xmingw.sh
* make_gnu_xmingwce.sh
* make_vc.bat
* make_vc.mak
* mpkg_tgz.sh
* bin/hb-func.sh
* bin/hb-mkslib.sh
* bin/hbmk.bat
* bin/hbmk_os2.cmd
* bin/postinst.sh
* config/bin.cf
* config/bsd/gcc.cf
* config/darwin/gcc.cf
* config/dos/bcc16.cf
* config/dos/djgpp.cf
* config/dos/owatcom.cf
* config/dos/rsx32.cf
* config/hpux/gcc.cf
* config/lib.cf
* config/linux/gcc.cf
* config/linux/owatcom.cf
* config/os2/gcc.cf
* config/os2/icc.cf
* config/rules.cf
* config/sunos/gcc.cf
* config/win/bcc32.cf
* config/win/dm.cf
* config/win/gcc.cf
* config/win/icc.cf
* config/win/mingw.cf
* config/win/mingwce.cf
* config/win/msvc.cf
* config/win/msvcce.cf
* config/win/owatcom.cf
* config/win/pocc.cf
* config/win/pocc64.cf
* config/win/poccce.cf
* config/win/rsxnt.cf
* config/win/xcc.cf
* contrib/gtalleg/Makefile
* contrib/hbapollo/Makefile
* contrib/hbcurl/Makefile
* contrib/hbfbird/Makefile
* contrib/hbfimage/Makefile
* contrib/hbgd/Makefile
* contrib/hbgd/tests/hbmk_b32.bat
* contrib/hbgd/tests/hbmk_vc.bat
* contrib/hbgf/hbgfgtk/Makefile
* contrib/hbhpdf/Makefile
* contrib/hbmysql/Makefile
* contrib/hbodbc/Makefile
* contrib/hbpgsql/Makefile
* contrib/hbssl/Makefile
* contrib/hbtip/ChangeLog
* contrib/hbwhat/Makefile
* contrib/hbwhat/tests/hbmk_b32.bat
* contrib/hbwhat/tests/hbmk_vc.bat
* contrib/mtpl_b32.bat
* contrib/mtpl_b32.mak
* contrib/mtpl_gcc.mak
* contrib/mtpl_gcc.sh
* contrib/mtpl_vc.bat
* contrib/mtpl_vc.mak
* contrib/rddads/Makefile
* contrib/rddsql/sddfb/Makefile
* contrib/rddsql/sddmy/Makefile
* contrib/rddsql/sddpg/Makefile
* doc/es/tracing.txt
* doc/gmake.txt
* doc/tracing.txt
* include/hbapi.h
* source/main/harbour.c
* source/pp/hbpp.c
* source/rdd/dbffpt/Makefile
* source/vm/cmdarg.c
* source/vm/Makefile
* source/vm/vmmt/Makefile
* tests/multifnc/Makefile
* tests/testid.prg
* utils/hbdoc/Makefile
* utils/hbi18n/Makefile
* utils/hbmake/hbmake.prg
* utils/hbmake/Makefile
* utils/hbrun/Makefile
* utils/hbtest/Makefile
* Renamed remaining build configration envvars:
- PRG_USR -> HB_USER_PRGFLAGS
- C_USR -> HB_USER_CFLAGS
- L_USR -> HB_USER_LDFLAGS
- A_USR -> HB_USER_AFLAGS
- MK_USR -> HB_USER_MAKEFLAGS
(finally settled with HB_USER* instead of HB_USR*,
this also means that HB_USER_LIBS was kept unchanged.)
; Please update your environment.
You may use these commands to make it easy:
gsar -o -sPRG_USR -rHB_USER_PRGFLAGS *
gsar -o -sC_USR -rHB_USER_CFLAGS *
gsar -o -sL_USR -rHB_USER_LDFLAGS *
gsar -o -sA_USR -rHB_USER_AFLAGS *
gsar -o -sMK_USR -rHB_USER_MAKEFLAGS *
177 lines
5.0 KiB
Bash
Executable File
177 lines
5.0 KiB
Bash
Executable File
#!/bin/sh
|
|
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
|
|
#
|
|
# $Id$
|
|
#
|
|
# This script simplifies cross-compiling Harbour for Windows from Unix systems.
|
|
#
|
|
# Copyright 2003-2005 by Phil Krylov <phil a t newstar.rinet.ru>
|
|
#
|
|
|
|
cleanup()
|
|
{
|
|
rm -fR "${HB_BIN_COMPILE}"
|
|
}
|
|
|
|
UNAME=`uname`
|
|
UNAMEL=`echo "$UNAME"|tr A-Z a-z`
|
|
UNAMEU=`echo "$UNAME"|tr a-z A-Z`
|
|
|
|
export HB_ARCHITECTURE=win
|
|
export HB_COMPILER=mingw
|
|
|
|
if [ "$OSTYPE" = "msdosdjgpp" ]; then
|
|
HB_HOST_ARCH="dos"
|
|
HB_HOST_CC="djgpp"
|
|
else
|
|
HB_HOST_ARCH="${UNAMEL}"
|
|
HB_HOST_CC="gcc"
|
|
case "$HB_HOST_ARCH" in
|
|
*windows*|*mingw32*|msys*) HB_HOST_ARCH="win"; HB_HOST_CC="mingw" ;;
|
|
*dos) HB_HOST_ARCH="dos" ;;
|
|
*bsd) HB_HOST_ARCH="bsd" ;;
|
|
esac
|
|
fi
|
|
|
|
CC_HB_USER_PRGFLAGS=""
|
|
if [ "$HB_HOST_ARCH" != "win" ]; then
|
|
CC_HB_USER_PRGFLAGS="-D__PLATFORM__WINDOWS -undef:__PLATFORM__UNIX -undef:__PLATFORM__$UNAMEU"
|
|
fi
|
|
|
|
[ -z "$HB_INSTALL_PREFIX" ] && \
|
|
export HB_INSTALL_PREFIX="/usr/local/mingw32-harbour"
|
|
export CC_HB_USER_CFLAGS=""
|
|
export HB_USER_CFLAGS="$CC_HB_USER_CFLAGS $HB_USER_CFLAGS"
|
|
export CC_HB_USER_PRGFLAGS
|
|
export HB_USER_PRGFLAGS="$CC_HB_USER_PRGFLAGS $HB_USER_PRGFLAGS"
|
|
|
|
# try to detect MinGW cross-compiler location
|
|
# using some default platform settings
|
|
if [ -f /etc/debian_version ]; then
|
|
MINGW_PREFIX=/usr
|
|
TARGET=i586-mingw32msvc
|
|
CCPREFIX="$TARGET-"
|
|
elif [ -f /etc/gentoo-release ]; then
|
|
if [ -x /opt/xmingw/bin/i386-mingw32-gcc ]; then
|
|
MINGW_PREFIX=/opt/xmingw
|
|
TARGET=i386-mingw32msvc
|
|
else
|
|
MINGW_PREFIX=/usr
|
|
TARGET=i686-mingw32
|
|
fi
|
|
CCPREFIX="$TARGET-"
|
|
elif [ "$UNAME" = "FreeBSD" ]; then
|
|
MINGW_PREFIX=/usr/local/mingw32
|
|
TARGET="."
|
|
CCPREFIX=""
|
|
UNAMEL=bsd
|
|
elif [ -x /usr/local/bin/i[3456]86-mingw*-gcc ]; then
|
|
MINGW_PREFIX=/usr/local
|
|
TARGET=`echo /usr/local/bin/i[3456]86-mingw*-gcc|sed -e '1 !d' -e 's/.*\(i[3456]86-mingw[^-]*\).*/\1/g'`
|
|
CCPREFIX="$TARGET-"
|
|
fi
|
|
|
|
if [ -z "${MINGW_PREFIX}" ] || \
|
|
( [ ! -x ${MINGW_PREFIX}/bin/${CCPREFIX}gcc ] && \
|
|
[ ! -x ${MINGW_PREFIX}/${TARGET}/bin/${CCPREFIX}gcc ] ); then
|
|
# MinGW cross-compiler not found in default location
|
|
# scan some usually used locations and names
|
|
for d in /usr /usr/local /usr/local/mingw32 /opt/xmingw; do
|
|
if [ -z "${MINGW_PREFIX}" ] && [ -d $d/bin ]; then
|
|
MINGWGCC=`echo $d/bin/i[3456]86-mingw*-gcc`
|
|
if [ -x $MINGWGCC ]; then
|
|
MINGW_PREFIX=$d
|
|
TARGET=`echo "$MINGWGCC"|sed -e '1 !d' -e 's/.*\(i[3456]86-mingw[^-]*\).*/\1/g'`
|
|
CCPREFIX="$TARGET-"
|
|
else
|
|
MINGWGCC=`echo $d/i[3456]86-mingw*/bin/gcc`
|
|
if [ -x $MINGWGCC ]; then
|
|
MINGW_PREFIX=$d
|
|
TARGET=`echo "$MINGWGCC"|sed -e '1 !d' -e 's!.*\(i[3456]86-mingw[^/]*\).*!\1!g'`
|
|
CCPREFIX=""
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [ ! -x ${MINGW_PREFIX}/bin/${CCPREFIX}gcc ] && \
|
|
[ ! -x ${MINGW_PREFIX}/${TARGET}/bin/${CCPREFIX}gcc ]; then
|
|
echo "Can't determine the location for the MinGW32 cross-compiler."
|
|
echo "Please install it or add your platform to the $0 script."
|
|
exit 1
|
|
fi
|
|
|
|
CCPATH="$MINGW_PREFIX/bin:$MINGW_PREFIX/$TARGET/bin:"
|
|
PATH="$CCPATH$PATH"
|
|
|
|
export PATH CCPATH CCPREFIX
|
|
|
|
export HB_TOOLS_PREF="hbw"
|
|
export HB_XBUILD="win"
|
|
[ "${HB_HOST_BUILD}" = "all" ] || export HB_HOST_BUILD="lib"
|
|
|
|
export HB_BIN_COMPILE="/tmp/hb-xmingw-$$"
|
|
rm -fR "${HB_BIN_COMPILE}"
|
|
trap cleanup EXIT >/dev/null 2>&1
|
|
mkdir ${HB_BIN_COMPILE}
|
|
|
|
DIR=`cd $(dirname $0);pwd`
|
|
if [ -z "${HB_COMP_PATH}" ]; then
|
|
if which harbour > /dev/null 2>&1; then
|
|
HB_COMP_PATH=`which harbour 2> /dev/null`
|
|
else
|
|
HB_COMP_PATH="$DIR/source/main/$HB_HOST_ARCH/$HB_HOST_CC/harbour"
|
|
fi
|
|
fi
|
|
|
|
if [ -x "${HB_COMP_PATH}" ]; then
|
|
ln -s "${HB_COMP_PATH}" ${HB_BIN_COMPILE}/harbour.exe
|
|
else
|
|
echo "You must have a working 'harbour' executable for your platform on your PATH."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "${HB_PPGEN_PATH}" ]; then
|
|
if which hbpp &> /dev/null; then
|
|
HB_PPGEN_PATH=`which hbpp 2> /dev/null`
|
|
elif [ -x "${DIR}/source/pp/${HB_HOST_ARCH}/${HB_HOST_CC}/hbpp" ]; then
|
|
HB_PPGEN_PATH="${DIR}/source/pp/${HB_HOST_ARCH}/${HB_HOST_CC}/hbpp"
|
|
else
|
|
DIR=`dirname ${HB_COMP_PATH}`
|
|
if [ -x "${DIR}/hbpp" ]; then
|
|
HB_PPGEN_PATH="${DIR}/hbpp"
|
|
else
|
|
HB_PPGEN_PATH="$DIR/source/pp/$HB_HOST_ARCH/$HB_HOST_CC/hbpp"
|
|
fi
|
|
fi
|
|
fi
|
|
if [ -d "${HB_PPGEN_PATH}" ]; then
|
|
if [ -x "${HB_PPGEN_PATH}/hbpp" ]; then
|
|
HB_PPGEN_PATH="${HB_PPGEN_PATH}/hbpp"
|
|
fi
|
|
fi
|
|
if [ -x "${HB_PPGEN_PATH}" ] && [ -f "${HB_PPGEN_PATH}" ]; then
|
|
ln -s ${HB_PPGEN_PATH} ${HB_BIN_COMPILE}/hbpp.exe
|
|
HB_PPGEN_PATH="${HB_BIN_COMPILE}"
|
|
else
|
|
echo "You must have a working 'hbpp' executable for your platform on your PATH."
|
|
exit 1
|
|
fi
|
|
export HB_PPGEN_PATH
|
|
|
|
case "$1" in
|
|
tgz|gnu)
|
|
ext=$1
|
|
shift
|
|
. `dirname $0`/make_${ext}.sh "$@"
|
|
;;
|
|
*)
|
|
. `dirname $0`/make_gnu.sh "$@"
|
|
;;
|
|
esac
|
|
|
|
stat="$?"
|
|
cleanup
|
|
exit "${stat}"
|