From c2bfed14d8d580b6b68c4e42c5580210f061d746 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 2 Apr 2009 11:46:27 +0000 Subject: [PATCH] 2009-04-02 13:42 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * bin/hb-mkdyn.bat * bin/postinst.bat + Added support for GCC family .dll creation. (Cygwin not tested) This will also create .def files. Also implib .a files are possible, code is there commented. + Added 'wce' ARCH support. ! Fixed to not include gtwin in WinCE .dlls. + Added support for HB_DLLIBS envvar. ; NOTE: The benefits of using cmd shell instead of msys to create mingw builds is that hbrun-dll and hbtest-dll are also created and you don't have use forward slashes in HB_INC_* envvars. It also allows to more easily add implib creation in the future. Overall the Windows build environment is more uniform this way. msys build output though is much sleeker and also seems faster. If this method turns out to be okay, it may become the default/support/standard way to build Harbour with MinGW on Windows. (if not we can return to the msys method) ; TOFIX: Shared MinGW executables cannot be built if Harbour was built with -DHB_DYNLIB. IMO this macro should be ignored in MinGW builds as there is no separate DLL build and non-DLL. [ I cannot fix this. ] Until then I had to a hack to starter batch files. * mpkg_win.bat * Switched to use make_gnu.bat instead of make_gnu.sh to build GCC family targets. * make_gnu.bat + Added special codepath for GCC familty as it needs one pass only to create .dlls. * INSTALL * Updated to reflect now possible non-msys MinGW build. * Updated example to use non-msys flavours. + Readded MinGW + msys example. % Minor simplification in mingw64/mingwce targets. (HB_CCPATH no longer needed on Windows) --- harbour/ChangeLog | 41 ++++++++++++ harbour/INSTALL | 106 ++++++++++++++++-------------- harbour/bin/hb-mkdyn.bat | 135 +++++++++++++++++++++++++++++++++++---- harbour/bin/postinst.bat | 6 ++ harbour/make_gnu.bat | 17 +++-- harbour/mpkg_win.bat | 6 -- 6 files changed, 238 insertions(+), 73 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9f3a7a10b6..439341558f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,47 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-02 13:42 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * bin/hb-mkdyn.bat + * bin/postinst.bat + + Added support for GCC family .dll creation. (Cygwin not tested) + This will also create .def files. Also implib .a files are possible, + code is there commented. + + Added 'wce' ARCH support. + ! Fixed to not include gtwin in WinCE .dlls. + + Added support for HB_DLLIBS envvar. + ; NOTE: The benefits of using cmd shell instead of msys to create + mingw builds is that hbrun-dll and hbtest-dll are also + created and you don't have use forward slashes in HB_INC_* + envvars. It also allows to more easily add implib creation + in the future. Overall the Windows build environment is + more uniform this way. msys build output though is much + sleeker and also seems faster. + If this method turns out to be okay, it may become the + default/support/standard way to build Harbour with MinGW + on Windows. (if not we can return to the msys method) + + ; TOFIX: Shared MinGW executables cannot be built if Harbour was built + with -DHB_DYNLIB. IMO this macro should be ignored in MinGW + builds as there is no separate DLL build and non-DLL. + [ I cannot fix this. ] + Until then I had to a hack to starter batch files. + + * mpkg_win.bat + * Switched to use make_gnu.bat instead of make_gnu.sh to build + GCC family targets. + + * make_gnu.bat + + Added special codepath for GCC familty as it needs one pass only + to create .dlls. + + * INSTALL + * Updated to reflect now possible non-msys MinGW build. + * Updated example to use non-msys flavours. + + Readded MinGW + msys example. + % Minor simplification in mingw64/mingwce targets. + (HB_CCPATH no longer needed on Windows) + 2009-04-02 11:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * make_gnu_xmingwce.sh * bin/hb-mkdyn.sh diff --git a/harbour/INSTALL b/harbour/INSTALL index e55321b38b..0b7ebb18c1 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -33,6 +33,45 @@ HOW TO BUILD AND INSTALL HARBOUR $ ./hello You should see 'Hello world!' on screen. + Windows + ------- + Platform specific prerequisites: + + 1.) Windows NT or compatible system is required to build Harbour. + 2.) Make sure to have your C compiler of choice properly installed. + Refer to your C compiler installation and setup instructions for + details. It's recommended to make sure no tools in your PATH + belonging to other C compilers are interfering with your setup. + For the list of supported compilers, please look up the + relevant section of this file. + 3.) Make sure to have GNU Make. Certain older versions and builds + are untested and may not work. We recommend the one distributed + by MinGW team. Use this link to get it: + https://sourceforge.net/project/showfiles.php?group_id=2435&package_id=23918 + If you have it, you have three choices: + - Copy mingw32-make.exe or make.exe into a separate directory + and add that directory to the beginning of your PATH. + (recommended) + - Put mingw32-make.exe anywhere in your PATH. + - Put mingw32-make.exe in Harbour source root dir. + If you're using MinGW compiler, you don't have to bother with + all this. + + > set HB_COMPILER= + > set HB_INSTALL_PREFIX= + > make_gnu.bat install + + To test it, go to \bin directory and type: + > hbmk2 ..\tests\hello.prg + > hello + You should see 'Hello world!' on screen. + + NOTE: is your destination directory where executables, + libraries and headers will be created. Use absolute paths + only. For a peace of mind, avoid using spaces, quotes + in the name. You can leave it empty, in this case the + results will be created under the current directory tree. + Windows with MinGW + msys ------------------------- This is the recommended way to build with MinGW. @@ -62,43 +101,6 @@ HOW TO BUILD AND INSTALL HARBOUR NOTE: should use Cygwin drive notation: /cygdrive/c for C: - Windows with other compilers (MSVC, Watcom, Borland, Pelles, etc.) - ---------------------------- - Platform specific prerequisites: - - 1.) Windows NT or compatible system is required to build Harbour. - 2.) Make sure to have your C compiler of choice properly installed. - Refer to your C compiler installation and setup instructions for - details. It's recommended to make sure no tools in your PATH - belonging to other C compilers are interfering with your setup. - For the list of supported compilers, please look up the - relevant section of this file. - 3.) Make sure to have GNU Make. Certain older versions and builds - are untested and may not work. We recommend the one distributed - by MinGW team. Use this link to get it: - https://sourceforge.net/project/showfiles.php?group_id=2435&package_id=23918 - If you have it, you have three choices: - - Copy mingw32-make.exe or make.exe into a separate directory - and add that directory to the beginning of your PATH. - (recommended) - - Put mingw32-make.exe anywhere in your PATH. - - Put mingw32-make.exe in Harbour source root dir. - - > set HB_COMPILER= - > set HB_INSTALL_PREFIX= - > make_gnu.bat install - - To test it, go to \bin directory and type: - > hbmk2 ..\tests\hello.prg - > hello - You should see 'Hello world!' on screen. - - NOTE: is your destination directory where executables, - libraries and headers will be created. Use absolute paths - only. For a peace of mind, avoid using spaces, quotes - in the name. You can leave it empty, in this case the - results will be created under the current directory tree. - DOS --- > set HB_COMPILER=<[djgpp]|owatcom> @@ -150,7 +152,7 @@ HOW TO ENABLE OPTIONAL COMPONENTS BEFORE BUILD HB_INC_QT=C:\Qt\2009.01\qt\include HB_INC_SQLITE3=C:\sqlite3 (defaults to locally hosted version on win/os2) - NOTES: - For mingw and cygwin you have to use forward slashes + NOTES: - For mingw+msys and cygwin you have to use forward slashes and also cygwin drive notation for cygwin. - Space in directory names isn't currently supported. - Don't put the dir inside double quotes. @@ -348,7 +350,17 @@ EXAMPLES --- --- MinGW GCC - set PATH=C:\devl\msys\1.0.11\bin;C:\devl\MinGW-433\bin;%PATH% + set PATH=C:\devl\MinGW-433\bin;%PATH% + rem + set HB_COMPILER=mingw + rem + set HB_INSTALL_PREFIX=C:\hb-%HB_COMPILER% + call make_gnu.bat %1 %2 > log-%HB_COMPILER%.txt 2>&1 + --- + + --- MinGW GCC with msys + set PATH=C:\devl\msys\1.0.11\bin;%PATH% + set PATH=C:\devl\MinGW-433\bin;%PATH% rem set HB_COMPILER=mingw rem @@ -357,31 +369,29 @@ EXAMPLES --- --- MinGW GCC for x64 (requires native x86 Harbour binaries) - set HB_CCPATH=C:\devl\MinGW-440-64\bin + set PATH=C:\devl\MinGW-440-64\bin;%PATH% set HB_CCPREFIX=x86_64-pc-mingw32- - set PATH=C:\devl\msys\1.0.11\bin;%HB_CCPATH%;%PATH% rem set HB_COMPILER=mingw64 rem set HB_BIN_COMPILE=C:\hb-mingw\bin set HB_PPGEN_PATH=%HB_BIN_COMPILE% rem - set HB_INSTALL_PREFIX=/c/hb-%HB_COMPILER% - sh make_gnu.sh %1 %2 > log-%HB_COMPILER%.txt 2>&1 + set HB_INSTALL_PREFIX=C:\hb-%HB_COMPILER% + call make_gnu.bat %1 %2 > log-%HB_COMPILER%.txt 2>&1 --- --- MinGW GCC for WinCE/ARM (requires native x86 Harbour binaries) - set HB_CCPATH=C:\devl\MinGW-410-ce\opt\mingw32ce\bin + set PATH=C:\devl\MinGW-410-ce\opt\mingw32ce\bin;%PATH% set HB_CCPREFIX=arm-wince-mingw32ce- - set PATH=C:\devl\msys\1.0.11\bin;%HB_CCPATH%;%PATH% rem set HB_COMPILER=mingwce rem set HB_BIN_COMPILE=C:\hb-mingw\bin set HB_PPGEN_PATH=%HB_BIN_COMPILE% rem - set HB_INSTALL_PREFIX=/c/hb-%HB_COMPILER% - sh make_gnu.sh %1 %2 > log-%HB_COMPILER%.txt 2>&1 + set HB_INSTALL_PREFIX=C:\hb-%HB_COMPILER% + call make_gnu.bat %1 %2 > log-%HB_COMPILER%.txt 2>&1 --- --- Open Watcom C++ @@ -509,7 +519,7 @@ EXAMPLES --8<-- rem ; To create installation packages (.exe + .zip), - rem replace last lines (calling make_gnu.*) with these two: + rem replace last line (calling make_gnu.bat) with these two: set PATH=C:\devl\NSIS-2.44;%PATH% call mpkg_win.bat > log-%HB_COMPILER%.txt 2>&1 -->8-- diff --git a/harbour/bin/hb-mkdyn.bat b/harbour/bin/hb-mkdyn.bat index cb0ecd00b5..59b0ed6160 100644 --- a/harbour/bin/hb-mkdyn.bat +++ b/harbour/bin/hb-mkdyn.bat @@ -20,21 +20,34 @@ if "%HB_ARCHITECTURE%" == "" ( echo HB_ARCHITECTURE needs to be set. && goto END if "%HB_COMPILER%" == "" ( echo HB_COMPILER needs to be set. && goto END ) set HB_DLL_VERSION=11 -set HB_DLL_LIBS=hbcommon hbpp hbrtl hbmacro hblang hbcpage hbpcre hbzlib hbextern hbrdd rddntx rddnsx rddcdx rddfpt hbsix hbhsx hbusrrdd gtcgi gtpca gtstd gtwin gtwvt gtgui hbmaindllh +set HB_DLL_LIBS=hbcommon hbpp hbrtl hbmacro hblang hbcpage hbpcre hbzlib hbextern hbrdd rddntx rddnsx rddcdx rddfpt hbsix hbhsx hbusrrdd gtcgi gtpca gtstd gtwvt gtgui hbmaindllh +set HB_DLL_LIBS_WIN=gtwin set HB_DLL_LIBS_ST=hbvm set HB_DLL_LIBS_MT=hbvmmt +if "%HB_ARCHITECTURE%" == "wce" set HB_DLL_LIBS_WIN= +if "%HB_COMPILER%" == "msvcce" set HB_DLL_LIBS_WIN= +if "%HB_COMPILER%" == "mingwce" set HB_DLL_LIBS_WIN= +if "%HB_COMPILER%" == "poccce" set HB_DLL_LIBS_WIN= + if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_icc" goto DO_MSVC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_iccia64" goto DO_MSVC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvc" goto DO_MSVC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvc64" goto DO_MSVC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcia64" goto DO_MSVC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcce" goto DO_MSVC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_msvcarm" goto DO_MSVC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingw" goto DO_GCC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingw64" goto DO_GCC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingwce" goto DO_GCC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_mingwarm" goto DO_GCC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_cygwin" goto DO_GCC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_bcc" goto DO_BCC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_owatcom" goto DO_OWATCOM if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_pocc" goto DO_POCC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_pocc64" goto DO_POCC if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_poccce" goto DO_POCC +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_poccarm" goto DO_POCC echo Platform %HB_ARCHITECTURE% / %HB_COMPILER% isn't supported. goto END @@ -55,7 +68,7 @@ if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_iccia64" set _BIN_LINK=xilink rem ; Extract neutral objects echo.> _hboneut.txt -for %%f in (%HB_DLL_LIBS%) do ( +for %%f in (%HB_DLL_LIBS% %HB_DLL_LIBS_WIN%) do ( if exist "%HB_LIB_INSTALL%\%%f.lib" ( echo Processing library: %%f %_BIN_LIB% "%HB_LIB_INSTALL%\%%f.lib" /nologo /list > _hboraw.txt @@ -117,16 +130,19 @@ if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvc" set _DST_NAME_ST=harbour- if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvc" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION% if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcce" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-arm if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcce" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_msvcarm" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_msvcarm" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-arm if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvc64" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-x64 if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvc64" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-x64 if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcia64" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-ia64 if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcia64" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-ia64 -if not "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcce" set _SYSLIBS=user32.lib ws2_32.lib advapi32.lib gdi32.lib -if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcce" set _SYSLIBS=wininet.lib ws2.lib +set _SYSLIBS=user32.lib ws2_32.lib advapi32.lib gdi32.lib +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_msvcce" set _SYSLIBS=wininet.lib ws2.lib +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_msvcarm" set _SYSLIBS=wininet.lib ws2.lib -echo Making %_DST_NAME_ST%.dll... && %_BIN_LINK% /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll" @_hboneut.txt @_hbost.txt %_SYSLIBS% -echo Making %_DST_NAME_MT%.dll... && %_BIN_LINK% /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll" @_hboneut.txt @_hbomt.txt %_SYSLIBS% +echo Making %_DST_NAME_ST%.dll... && %_BIN_LINK% /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll" @_hboneut.txt @_hbost.txt %_SYSLIBS% %HB_DLLIBS% +echo Making %_DST_NAME_MT%.dll... && %_BIN_LINK% /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll" @_hboneut.txt @_hbomt.txt %_SYSLIBS% %HB_DLLIBS% if exist "%HB_BIN_INSTALL%\%_DST_NAME_ST%.lib" move "%HB_BIN_INSTALL%\%_DST_NAME_ST%.lib" "%HB_LIB_INSTALL%\%_DST_NAME_ST%.lib" if exist "%HB_BIN_INSTALL%\%_DST_NAME_MT%.lib" move "%HB_BIN_INSTALL%\%_DST_NAME_MT%.lib" "%HB_LIB_INSTALL%\%_DST_NAME_MT%.lib" @@ -161,7 +177,7 @@ echo. c0d32.obj +> _hballmt.txt rem ; Extract neutral objects echo.> _hboneut.txt -for %%f in (%HB_DLL_LIBS%) do ( +for %%f in (%HB_DLL_LIBS% %HB_DLL_LIBS_WIN%) do ( if exist "%HB_LIB_INSTALL%\%%f.lib" ( echo Processing library: %%f tlib "%HB_LIB_INSTALL%\%%f.lib", _hboraw.txt > nul @@ -243,8 +259,8 @@ cd .. set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-bcc set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-bcc -echo. , "%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll",, cw32mt.lib import32.lib >> _hballst.txt -echo. , "%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll",, cw32mt.lib import32.lib >> _hballmt.txt +echo. , "%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll",, cw32mt.lib import32.lib %HB_DLLIBS% >> _hballst.txt +echo. , "%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll",, cw32mt.lib import32.lib %HB_DLLIBS% >> _hballmt.txt echo Making %_DST_NAME_ST%.dll... && ilink32 -q -Gn -C -aa -Tpd -Gi -x c0d32.obj @_hballst.txt echo Making %_DST_NAME_MT%.dll... && ilink32 -q -Gn -C -aa -Tpd -Gi -x c0d32.obj @_hballmt.txt @@ -280,7 +296,7 @@ cd _dll echo.> _hbsst.txt echo.> _hbsmt.txt -for %%f in (%HB_DLL_LIBS%) do ( +for %%f in (%HB_DLL_LIBS% %HB_DLL_LIBS_WIN%) do ( echo FILE '%HB_LIB_INSTALL%\%%f.lib'>> _hbsst.txt echo FILE '%HB_LIB_INSTALL%\%%f.lib'>> _hbsmt.txt ) @@ -319,7 +335,7 @@ cd _dll rem ; Extract neutral objects echo.> _hboneut.txt -for %%f in (%HB_DLL_LIBS%) do ( +for %%f in (%HB_DLL_LIBS% %HB_DLL_LIBS_WIN%) do ( if exist "%HB_LIB_INSTALL%\%%f.lib" ( echo Processing library: %%f polib "%HB_LIB_INSTALL%\%%f.lib" /list /explode >> _hboneut.txt @@ -372,13 +388,16 @@ if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_pocc64" set _DST_NAME_ST=harbour- if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_pocc64" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-x64 if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_poccce" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-arm if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_poccce" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_poccarm" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_poccarm" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-arm if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_pocc" set _SYSLIBS=user32.lib ws2_32.lib advapi32.lib gdi32.lib if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_pocc64" set _SYSLIBS=user32.lib ws2_32.lib advapi32.lib gdi32.lib if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_poccce" set _SYSLIBS=wininet.lib ws2.lib +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_poccarm" set _SYSLIBS=wininet.lib ws2.lib -echo Making %_DST_NAME_ST%.dll... && polink /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll" @_hboneut.txt @_hbost.txt %_SYSLIBS% -echo Making %_DST_NAME_MT%.dll... && polink /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll" @_hboneut.txt @_hbomt.txt %_SYSLIBS% +echo Making %_DST_NAME_ST%.dll... && polink /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll" @_hboneut.txt @_hbost.txt %_SYSLIBS% %HB_DLLIBS% +echo Making %_DST_NAME_MT%.dll... && polink /nologo /dll /out:"%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll" @_hboneut.txt @_hbomt.txt %_SYSLIBS% %HB_DLLIBS% polib "%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll" /out:"%HB_LIB_INSTALL%\%_DST_NAME_ST%.lib" polib "%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll" /out:"%HB_LIB_INSTALL%\%_DST_NAME_MT%.lib" @@ -403,6 +422,96 @@ rmdir _dll goto END +:DO_GCC + +echo Making .dlls for %HB_ARCHITECTURE% / %HB_COMPILER%... + +md _dll +cd _dll + +rem ; Extract neutral objects +echo.> _hboneut.txt +for %%f in (%HB_DLL_LIBS% %HB_DLL_LIBS_WIN%) do ( + if exist "%HB_LIB_INSTALL%\lib%%f.a" ( + echo Processing library: %%f + %HB_CCPREFIX%ar -x "%HB_LIB_INSTALL%\lib%%f.a" + %HB_CCPREFIX%ar -t "%HB_LIB_INSTALL%\lib%%f.a" >> _hboneut.txt + ) else ( echo Library not found: %HB_LIB_INSTALL%\%%f.lib ) +) + +md _st +cd _st +rem ; Extract ST objects +echo.> _hbost.txt +for %%f in (%HB_DLL_LIBS_ST%) do ( + if exist "%HB_LIB_INSTALL%\lib%%f.a" ( + echo Processing library: %%f + %HB_CCPREFIX%ar -x "%HB_LIB_INSTALL%\lib%%f.a" + %HB_CCPREFIX%ar -t "%HB_LIB_INSTALL%\lib%%f.a" >> _hbost.txt + ) else ( echo Library not found: %HB_LIB_INSTALL%\%%f.lib ) +) +cd .. + +md _mt +cd _mt +rem ; Extract MT objects +echo.> _hbomt.txt +for %%f in (%HB_DLL_LIBS_MT%) do ( + if exist "%HB_LIB_INSTALL%\lib%%f.a" ( + echo Processing library: %%f + %HB_CCPREFIX%ar -x "%HB_LIB_INSTALL%\lib%%f.a" + %HB_CCPREFIX%ar -t "%HB_LIB_INSTALL%\lib%%f.a" >> _hbomt.txt + ) else ( echo Library not found: %HB_LIB_INSTALL%\%%f.lib ) +) +cd .. + +setlocal enabledelayedexpansion +set _HBOST= +for /f %%f in (_hboneut.txt) do set _HBOST=!_HBOST! %%f +for /f %%f in (_st\_hbost.txt) do set _HBOST=!_HBOST! _st\%%f +set _HBOMT= +for /f %%f in (_hboneut.txt) do set _HBOMT=!_HBOMT! %%f +for /f %%f in (_mt\_hbomt.txt) do set _HBOMT=!_HBOMT! _mt\%%f + +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingw" set _DST_NAME_ST=harbour-%HB_DLL_VERSION% +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingw" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION% +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingw64" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-x64 +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingw64" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-x64 +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingwce" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingwce" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_mingwarm" set _DST_NAME_ST=harbour-%HB_DLL_VERSION%-arm +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_mingwarm" set _DST_NAME_MT=harbourmt-%HB_DLL_VERSION%-arm + +set _SYSLIBS=-luser32 -lws2_32 -ladvapi32 -lgdi32 +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "win_mingwce" set _SYSLIBS=-lwininet -lws2 +if "%HB_ARCHITECTURE%_%HB_COMPILER%" == "wce_mingwarm" set _SYSLIBS=-lwininet -lws2 + +echo Making %_DST_NAME_ST%.dll... && %HB_CCPREFIX%gcc -shared -o "%HB_BIN_INSTALL%\%_DST_NAME_ST%.dll" %_HBOST% %HB_USER_LDFLAGS% %_SYSLIBS% %HB_DLLIBS% -Wl,--output-def,"%HB_BIN_INSTALL%\%_DST_NAME_ST%.def" +echo Making %_DST_NAME_MT%.dll... && %HB_CCPREFIX%gcc -shared -o "%HB_BIN_INSTALL%\%_DST_NAME_MT%.dll" %_HBOMT% %HB_USER_LDFLAGS% %_SYSLIBS% %HB_DLLIBS% -Wl,--output-def,"%HB_BIN_INSTALL%\%_DST_NAME_MT%.def" + +rem ,--out-implib,"%HB_LIB_INSTALL%\lib%_DST_NAME_ST%.a" +rem ,--out-implib,"%HB_LIB_INSTALL%\lib%_DST_NAME_MT%.a" + +rem ; Cleanup +cd _st +for /F %%o in (_hbost.txt) do ( del %%o ) +del _hbost.txt +cd .. +rmdir _st + +cd _mt +for /F %%o in (_hbomt.txt) do ( del %%o ) +del _hbomt.txt +cd .. +rmdir _mt + +for /F %%o in (_hboneut.txt) do ( del %%o ) +del _hboneut.txt +cd .. +rmdir _dll + +goto END + :END endlocal diff --git a/harbour/bin/postinst.bat b/harbour/bin/postinst.bat index 89f60d2a44..6bddcbe567 100644 --- a/harbour/bin/postinst.bat +++ b/harbour/bin/postinst.bat @@ -27,6 +27,12 @@ goto inst_%HB_ARCHITECTURE% rem Windows post install part if not "%OS%" == "Windows_NT" goto end +if "%HB_COMPILER%" == "mingw" set HB_DYNLIB=yes +if "%HB_COMPILER%" == "mingw64" set HB_DYNLIB=yes +if "%HB_COMPILER%" == "mingwce" set HB_DYNLIB=yes +if "%HB_COMPILER%" == "mingwarm" set HB_DYNLIB=yes +if "%HB_COMPILER%" == "cygwin" set HB_DYNLIB=yes + if not "%HB_DYNLIB%" == "yes" goto _SKIP_DLL_BIN call %~dp0hb-mkdyn.bat diff --git a/harbour/make_gnu.bat b/harbour/make_gnu.bat index 7cb18cd225..b2116bf3da 100644 --- a/harbour/make_gnu.bat +++ b/harbour/make_gnu.bat @@ -30,12 +30,6 @@ if "%HB_ARCHITECTURE%" == "" set HB_ARCHITECTURE=dos if "%HB_COMPILER%" == "" if not "%WINDIR%" == "" goto HELP if "%HB_COMPILER%" == "" set HB_COMPILER=djgpp -if "%HB_COMPILER%" == "mingw" ( echo For %HB_COMPILER% builds, use 'sh make_gnu.sh'. See INSTALL for more. && goto :EOF ) -if "%HB_COMPILER%" == "mingw64" ( echo For %HB_COMPILER% builds, use 'sh make_gnu.sh'. See INSTALL for more. && goto :EOF ) -if "%HB_COMPILER%" == "mingwce" ( echo For %HB_COMPILER% builds, use 'sh make_gnu.sh'. See INSTALL for more. && goto :EOF ) -if "%HB_COMPILER%" == "mingwarm" ( echo For %HB_COMPILER% builds, use 'sh make_gnu.sh'. See INSTALL for more. && goto :EOF ) -if "%HB_COMPILER%" == "cygwin" ( echo For %HB_COMPILER% builds, use 'sh make_gnu.sh'. See INSTALL for more. && goto :EOF ) - if "%HB_INSTALL_PREFIX%" == "" if "%OS%" == "Windows_NT" set HB_INSTALL_PREFIX=%~dp0 rem Set to constant value to be consistent with the non-GNU make files. @@ -121,6 +115,11 @@ if not exist %HB_DOC_INSTALL%\*.* md %HB_DOC_INSTALL% rem the .dlls and a final pass for the regular version. if not "%HB_ARCHITECTURE%" == "win" goto SKIP_WINDLL + if "%HB_COMPILER%" == "mingw" goto DO_GCC + if "%HB_COMPILER%" == "mingw64" goto DO_GCC + if "%HB_COMPILER%" == "mingwce" goto DO_GCC + if "%HB_COMPILER%" == "mingwarm" goto DO_GCC + if "%HB_COMPILER%" == "cygwin" goto DO_GCC if not "%HB_BUILD_DLL%" == "yes" goto SKIP_WINDLL set _HB_CONTRIBLIBS=%HB_CONTRIBLIBS% @@ -137,6 +136,12 @@ if not exist %HB_DOC_INSTALL%\*.* md %HB_DOC_INSTALL% %_HB_MAKE% clean install %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 goto MAKE_DONE +:DO_GCC + + set HB_DYNLIB=no + %_HB_MAKE% clean install %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 + goto MAKE_DONE + :SKIP_WINDLL %_HB_MAKE% %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/harbour/mpkg_win.bat b/harbour/mpkg_win.bat index f6857f5b37..8c45f5db90 100644 --- a/harbour/mpkg_win.bat +++ b/harbour/mpkg_win.bat @@ -50,13 +50,7 @@ set HB_BUILD_IMPLIB=no set HB_USER_CFLAGS=%HB_USER_CFLAGS% -DHB_FM_STATISTICS_OFF rem ; Build Harbour -if "%HB_COMPILER%" == "mingw" ( sh make_gnu.sh clean install && goto MK_PKG ) -if "%HB_COMPILER%" == "mingw64" ( sh make_gnu.sh clean install && goto MK_PKG ) -if "%HB_COMPILER%" == "mingwce" ( sh make_gnu.sh clean install && goto MK_PKG ) -if "%HB_COMPILER%" == "mingwarm" ( sh make_gnu.sh clean install && goto MK_PKG ) -if "%HB_COMPILER%" == "cygwin" ( sh make_gnu.sh clean install && goto MK_PKG ) call make_gnu.bat -:MK_PKG rem if errorlevel 1 goto MK_ERROR