* harbour/make_xmingw.sh
* minor modification in one message
+ harbour/make_rpmw32.sh
+ harbour/harbour-w32-spec
+ added script to build RPMs with cross build of Harbour for MS-Windows
using MinGW32 cross compiler.
make_rpmw32.sh should create harbour-w32-<ver>.i[345]86.rpm which
can be installed with platform native harbour RPMs.
This RPM contains Harbour libraries compiled for Win32 and
set of hbw* scripts which should be used instead of standard hb*
ones to create MS-Windows binaries. It means that you can create
standard Linux binaries and MS-Windows binaries in the same session
without setting/changing any additional environment variables, f.e:
hbmk -n -w -es2 test.prg
will create Linux binaries and:
hbwmk -n -w -es2 test.prg
will create binaries for MS-Windows.
Please also remember that if you create and install RPMs with Harbour
for WinCE/PocketPC (make_rpmce.sh) then hbce* scripts will create
WinCE/PocketPC binaries, f.e.:
hbcemk -n -w -es2 test.prg
144 lines
3.6 KiB
Bash
Executable File
144 lines
3.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $Id$
|
|
#
|
|
|
|
# ---------------------------------------------------------------
|
|
# Copyright 2007 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
|
# simple script to build Harbour-Win32 cross build RPMs
|
|
#
|
|
# See doc/license.txt for licensing terms.
|
|
# ---------------------------------------------------------------
|
|
|
|
######################################################################
|
|
# Conditional build:
|
|
# --with mysql - build mysql lib
|
|
# --with pgsql - build pgsql lib
|
|
# --with gd - build gd lib
|
|
# --with allegro - build GTALLEG - Allegro based GT driver
|
|
# --without odbc - do not build odbc lib
|
|
# --without adsrdd - do not build ADS RDD
|
|
# --without nf - do not build nanforum lib
|
|
######################################################################
|
|
|
|
test_reqrpm()
|
|
{
|
|
rpm -q --whatprovides "$1" &> /dev/null
|
|
}
|
|
|
|
get_rpmmacro()
|
|
{
|
|
local R X Y
|
|
|
|
R=`rpm --showrc|sed -e "/^-14:.${1}[^a-z0-9A-Z_]/ !d" -e "s/^-14: ${1}.//"`
|
|
X=`echo "${R}"|sed -e "s/.*\(%{\([^}]*\)}\).*/\2/"`
|
|
while [ "${X}" != "${R}" ]
|
|
do
|
|
Y=`get_rpmmacro "$X"`
|
|
if [ -n "${Y}" ]
|
|
then
|
|
R=`echo "${R}"|sed -e "s!%{${X}}!${Y}!g"`
|
|
X=`echo "${R}"|sed -e "s/.*\(%{\([^}]*\)}\).*/\2/"`
|
|
else
|
|
X="${R}"
|
|
fi
|
|
done
|
|
echo -n "${R}"
|
|
}
|
|
|
|
for d in /usr /usr/local /opt/xmingw
|
|
do
|
|
if [ -z "${TARGET}" ]
|
|
then
|
|
TARGET=`find $d/bin -name "i[3456]86-mingw*-gcc" -maxdepth 1 \
|
|
2>/dev/null | \
|
|
sed -e '1 !d' -e 's/.*\(i[3456]86-mingw[^-]*\).*/\1/g'`
|
|
MINGW_DIR=$d
|
|
fi
|
|
done
|
|
|
|
if [ -z "${TARGET}" ]
|
|
then
|
|
echo "Can't determine the location for the MinGW32 cross-compiler."
|
|
echo "Please install it or add valid path to the $0 script."
|
|
exit 1
|
|
fi
|
|
|
|
CCPREFIX="$TARGET-"
|
|
CCPATH="$MINGW_DIR/bin"
|
|
|
|
|
|
cd `dirname $0`
|
|
. bin/hb-func.sh
|
|
hb_ver=`get_hbver`
|
|
|
|
NEED_RPM="make gcc binutils bash"
|
|
|
|
FORCE=""
|
|
|
|
LAST=""
|
|
while [ $# -gt 0 ]
|
|
do
|
|
if [ "$1" = "--force" ]
|
|
then
|
|
FORCE="yes"
|
|
else
|
|
INST_PARAM="${INST_PARAM} $1"
|
|
fi
|
|
LAST="$1"
|
|
shift
|
|
done
|
|
|
|
TOINST_LST=""
|
|
for i in ${NEED_RPM}
|
|
do
|
|
test_reqrpm "$i" || TOINST_LST="${TOINST_LST} $i"
|
|
done
|
|
|
|
if [ -z "${TOINST_LST}" ] || [ "${FORCE}" = "yes" ]
|
|
then
|
|
. ./bin/pack_src.sh
|
|
stat="$?"
|
|
if [ -z "${hb_filename}" ]
|
|
then
|
|
echo "The script ./bin/pack_src.sh doesn't set archive name to \${hb_filename}"
|
|
exit 1
|
|
elif [ "${stat}" != 0 ]
|
|
then
|
|
echo "Error during packing the sources in ./bin/pack_src.sh"
|
|
exit 1
|
|
elif [ -f ${hb_filename} ]
|
|
then
|
|
if [ `id -u` != 0 ] && [ ! -f ${HOME}/.rpmmacros ]
|
|
then
|
|
RPMDIR="${HOME}/RPM"
|
|
mkdir -p ${RPMDIR}/SOURCES ${RPMDIR}/RPMS ${RPMDIR}/SRPMS \
|
|
${RPMDIR}/BUILD ${RPMDIR}/SPECS
|
|
echo "%_topdir ${RPMDIR}" > ${HOME}/.rpmmacros
|
|
else
|
|
RPMDIR=`get_rpmmacro "_topdir"`
|
|
fi
|
|
mv ${hb_filename} ${RPMDIR}/SOURCES/
|
|
sed -e "s|^%define version .*$|%define version ${hb_ver}|g" \
|
|
-e "s|^%define hb_ccpath .*$|%define hb_ccpath ${CCPATH}|g" \
|
|
-e "s|^%define hb_ccpref .*$|%define hb_ccpref ${CCPREFIX}|g" \
|
|
harbour-w32-spec > ${RPMDIR}/SPECS/harbour-w32.spec
|
|
if which rpmbuild &>/dev/null
|
|
then
|
|
RPMBLD="rpmbuild"
|
|
else
|
|
RPMBLD="rpm"
|
|
fi
|
|
cd ${RPMDIR}/SPECS
|
|
${RPMBLD} -ba harbour-w32.spec ${INST_PARAM}
|
|
else
|
|
echo "Cannot find archive file: ${hb_filename}"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "If you want to build Harbour compiler"
|
|
echo "you have to install the folowing RPM files:"
|
|
echo "${TOINST_LST}"
|
|
exit 1
|
|
fi
|