Colocando esse script para Linux gerar o .EXE "for windows".
Achei aqui: https://github.com/harbour/core/issues/281 Autores Valerio Messina e Lailton
Código: Selecionar todos
#!/bin/sh
# Copyright 2022 Valerio Messina, harbour 1.1.0 2022/12/19
# harbour is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ver 3
# this script (cross)compile a PRG file with harbour
# Syntax: $ harbour <source.prg> [win [32]]|[mac [arm]]
if (test "" = "$1") then
echo ERROR: harbour need a PRG file name
echo "Syntax: $ harbour <source.prg> [win [32]]|[mac [arm]]"
exit
fi
rm *.o *.c 2> /dev/null
deps="hbct.hbc xhb.hbc"
#deps=""
if (test "$2" = "win") then
# set env vars for mingw ...
if (test "$3" = "32") then
echo "Cross-building for Win32 ..."
export HOST=i686-w64-mingw32
else
echo "Cross-building for Win64 ..."
export HOST=x86_64-w64-mingw32
fi
export CROSS=${HOST}-
export CC=${CROSS}gcc
# set env vars for harbour ...
export HB_WITH_CURSES=no
export HB_BUILD_3RDEXT=no
export HB_BUILD_CONTRIBS=no
export HB_BUILD_DYN=no
export HB_BUILD_NAME=$HOST
export HB_CCPATH=/usr/bin/
export HB_CCPREFIX=$CROSS
export HB_COMPILER=mingw64 # or mingw, clang
export HB_CPU=x86-64 # or x86
if (test "$3" = "32") then
export HB_COMPILER=mingw # or mingw, clang
export HB_CPU=x86
fi
export HB_HOST_BIN=$HOME/c/harbour-core/bin/linux/gcc
export HB_PLATFORM=win
export HB_USER_LDFLAGS="-L$HOME/c/harbour_win/lib/win/mingw64"
if (test "$3" = "32") then
export HB_USER_LDFLAGS="-L$HOME/c/harbour_win/lib/win/mingw"
fi
fi
if (test "$2" = "mac") then
echo "Cross-building for macOS64 ..."
# set env vars for osxcross ...
export SDK_VERSION=11.1 # set built tools generation
export ODVER=20.2
export OHOST=i386-apple-darwin$ODVER # only till darwin17
export OHOST=x86_64-apple-darwin$ODVER
if (test "$3" = "arm") then
echo "arm64 Apple Silicon"
export OHOST=arm64-apple-darwin$ODVER
fi
export OCROSS=$OHOST-
export OSXROOT=/opt/osxcross
export OSX=$OSXROOT/target/bin
export OSXDEPS=$OSXROOT/target/macports
export OSXQUARTZ=$OSXROOT/target/quartz
export OSXCROSS_TARGET=darwin$ODVER
export MACOSX_DEPLOYMENT_TARGET=$SDK_VERSION # used for macports
export OSXCROSS_PKG_CONFIG_USE_NATIVE_VARIABLES=1
export PKG_CONFIG_LIBDIR=$OSXDEPS/pkgs/opt/local/lib/pkgconfig:$OSXDEPS/pkgs/opt/local/share/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_LIBDIR
export PATH=$OSX:$PATH
# set env vars for harbour ...
export TOOLCHAINDIR=$OSXROOT
export TOOLCHAIN_DIR=$OSXROOT
export HB_WITH_CURSES=no
export HB_BUILD_3RDEXT=no
export HB_BUILD_CONTRIBS=no
export HB_BUILD_DYN=no
export HB_BUILD_NAME=$OHOST
export HB_CCPATH=$OSX
export HB_CCPREFIX=$OCROSS
export HB_COMPILER=clang
export HB_CPU=x86-64
if (test "$3" = "arm") then
export HB_CPU=arm
fi
export HB_HOST_BIN=$HOME/c/harbour-core/bin/linux/gcc
export HB_PLATFORM=darwin
export HB_USER_LDFLAGS="-L$HOME/c/harbour_macOS.amd64/lib/darwin/clang -L$OSXROOT/target/lib/"
if (test "$3" = "arm") then
export HB_USER_LDFLAGS="-L$HOME/c/harbour_macOS.arm64/lib/darwin/clang -L$OSXROOT/target/lib/"
fi
fi
if (test "" = "$2") then # native compile
echo "Native building for Linux64 ..."
fi
echo "Running: $HOME/c/harbour-core/bin/linux/gcc/hbmk2 -workdir=. -inc $1 $deps"
$HOME/c/harbour-core/bin/linux/gcc/hbmk2 -workdir=. -inc $1 $deps
#rm *.o *.c 2> /dev/null
echo ""
Itamar M. Lins Jr.
