Win32: added comments and a script to build under Wine
authorSven-Ola Tuecke <sven-ola@gmx.de>
Sat, 5 Jul 2008 10:20:35 +0000 (12:20 +0200)
committerSven-Ola Tuecke <sven-ola@gmx.de>
Sat, 5 Jul 2008 10:20:35 +0000 (12:20 +0200)
Makefile
make/Makefile.win32
make/makewine.cmd [new file with mode: 0644]

index ca5a1ed..6343420 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -98,6 +98,7 @@ uberclean:    clean clean_libs
 #      BSD-xargs has no "--no-run-if-empty" aka "-r"
        find . \( -name '*.[od]' -o -name '*~' \) -not -path "*/.hg*" -print0 | xargs -0 rm -f
        $(MAKECMD) -C $(SWITCHDIR) clean
+       $(MAKECMD) -C $(CFGDIR) clean
 
 install: install_olsrd
 
index 0dc9a65..946939d 100644 (file)
@@ -26,6 +26,39 @@ OS_LIB_PTHREAD =
 OS_CFLAG_PTHREAD =
 OS_LIB_DYNLOAD =
 
+# Notes for compiling olsrd under Windows
+# ---------------------------------------
+# You need at least Cygwin installed. Start the Cygwin setup and select
+# flex,bison,make,mingw-core. Then run "make all libs" to compile olsrd.exe
+# and the plugin DLLs. To compile the GUI, you need MSVC6, PlatformSDK and
+# the NSIS installer. Adapt the path names below and run "make win32setup".
+# Alternatively, set environment vars e.g. in the Windows registry under
+# HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment e.g.
+#
+# set PATH=C:\PROGRA~1\MICROS~4\VC98\BIN;C:\PROGRA~1\MIFD68~1\BIN;C:\PROGRA~1\NSIS;%PATH%
+# set LIB=C:\PROGRA~1\MIFD68~1\LIB;C:\PROGRA~1\MICROS~4\VC98\LIB;C:\PROGRA~1\MICROS~4\VC98\MFC\LIB
+# set INCLUDE=C:\PROGRA~1\MIFD68~1\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\MFC\INCLUDE
+#
+# You can install Cygwin under Wine. Then "wineconsole make all libs win32lib"
+# does it's job (slowly), but there may be issues while re-invoking MSVC from
+# bash.exe during "wineconsole win32setup". Note, that Wine on EXT2/EXT3 prevents
+# the Cygwin "!<symlink>" files from working somehow. You may need to install Cygwin
+# under Windows to get a correct gcc/mingw setup, then copy to your Linux
+# box, then replace all "!<symlink>" files by real symlinks, e.g.
+#
+# cd ~/.wine/drive_c/Programme/cygwin
+# for src in $(grep '!<symlink>' . -rl 2>&-);do
+#  if [ $(stat -c "%s" $src) -lt 100 ];then
+#   dst=$(sed -e's/^\!<symlink>//' $src)
+#   echo "ln -sf $dst $src"
+#  fi
+# done
+#
+# Required software versions:
+# MSVC6 GUI (with MFC!) runs under Wine (copy MFC42.DLL & MSVCP60.DLL)
+# Platform SDK, search for "February 2003 SDK"
+# Cygwin 1.5.x and Wine-1.1.0 or above
+
 PROGDIR = c:/Programme
 PROGCYG = /cygdrive/c/Programme
 PSDKDIR = $(PROGDIR)/Microsoft SDK
@@ -35,18 +68,18 @@ MSVCCYG = $(PROGCYG)/Microsoft\ Visual\ Studio
 NSISDIR = $(PROGDIR)/NSIS
 NSISCYG = $(PROGCYG)/NSIS
 
-# Necessary for running cygwin under wine. Both the "-C" option and MAKELEVEL will oops...
+# Necessary for running cygwin under wine. Both the "-C" option and MAKELEVEL>0 will oops...
 MAKE := sh -c 'cmd=$$0;while [ 0 -lt $$\# ];do case $$1 in -C) cmd="cd $$2 && $$cmd";shift 2;; *) cmd="$$cmd \"$$1\"";shift;;esac;done;sh -c "export MAKELEVEL=0 && $$cmd"' $(MAKE)
 
 gui/win32/Shim/Release/shim.obj: gui/win32/Shim/shim.c
                test -d $(dir $@) || mkdir -p $(dir $@)
-               $(MSVCCYG)/VC98/Bin/CL.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && CL.EXE \
                        /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" \
                        /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" \
                        /Fp"$(dir $@)/Shim.pch" /YX /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c "$<"
 
 gui/win32/Shim/Release/Shim.exe: gui/win32/Shim/Release/shim.obj
-               $(MSVCCYG)/VC98/Bin/LINK.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LINK.EXE \
                        /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" \
                        kernel32.lib user32.lib \
                        /nologo /subsystem:console /incremental:no /machine:I386 /out:"$@" "$^"
@@ -71,24 +104,25 @@ WIN32OBJFILES=$(addprefix gui/win32/Main/Release/, $(addsuffix .obj,  $(WIN32FIL
 
 gui/win32/Main/Release/Frontend.res: gui/win32/Main/Frontend.rc
                test -d $(dir $@) || mkdir -p $(dir $@)
-               $(PSDKCYG)/Bin/RC.Exe /l 0x407 /i"$(PSDKDIR)/Include" /i"$(MSVCDIR)/VC98/MFC/Include" /fo"$@" /d NDEBUG $<
+               PATH=$(PSDKCYG)/Bin:$(MSVCCYG)/Common/MSDev98/Bin:$$PATH && RC.EXE \
+                       /l 0x407 /i"$(PSDKDIR)/Include" /i"$(MSVCDIR)/VC98/MFC/Include" /fo"$@" /d NDEBUG "$<"
 
 gui/win32/Main/Release/Switch.exe: gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res $(WIN32CPPFILES)
                test -d $(dir $@) || mkdir -p $(dir $@)
-               $(MSVCCYG)/VC98/Bin/CL.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && CL.EXE \
                        /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" /I"$(MSVCDIR)/VC98/MFC/Include" /I"src" \
                        /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" \
                        /Fp"$(dir $@)/Frontend.pch" /YX"stdafx.h" /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c \
                        $(WIN32CPPFILES)
-               $(MSVCCYG)/VC98/Bin/LINK.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LINK.EXE \
                        /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" /LIBPATH:"$(MSVCDIR)/VC98/MFC/Lib" \
                        ws2_32.lib iphlpapi.lib \
                        gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res \
                        /nologo /subsystem:windows /incremental:no /machine:I386 /out:"$@" \
                        $(WIN32OBJFILES)
 
-win32setup: gui/win32/Inst/installer.nsi gui/win32/Shim/Release/Shim.exe gui/win32/Main/Release/Switch.exe
-               $(NSISCYG)/makensis.exe $<
+win32setup: gui/win32/Inst/installer.nsi default_target libs gui/win32/Shim/Release/Shim.exe gui/win32/Main/Release/Switch.exe
+               PATH=$(NSISCYG):$$PATH && makensis.exe $<
 
 win32lib: gui/win32/Main/olsrd_cfgparser.lib
 
@@ -96,7 +130,8 @@ gui/win32/Main/olsrd_cfgparser.lib: cfgparser
                @# Using the cygwin dlltool does not work (missing functions hooks)
                @# dlltool --input-def src/cfgparser/olsrd_cfgparser.def --dllname src/cfgparser/olsrd_cfgparser.dll --output-lib $@
                @# Use the Microsoft Lib Tool instead
-               $(MSVCCYG)/VC98/Bin/LIB.EXE /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LIB.EXE \
+                       /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib
 
 # Local Variables:
 # mode: makefile
diff --git a/make/makewine.cmd b/make/makewine.cmd
new file mode 100644 (file)
index 0000000..9f2450d
--- /dev/null
@@ -0,0 +1,24 @@
+rem @echo off
+
+REM "make win32setup" does not work under Wine+Cygwin
+REM Compile with this: "wine cmd /c make/makewine.cmd"
+
+SET PRGS=C:\Programme
+SET PSDK=%PRGS%\Microsoft SDK
+SET MSVC=%PRGS%\Microsoft Visual Studio
+SET PATH=%MSVC%\VC98\BIN;%PSDK%\BIN;%PRGS%\NSIS;%PATH%
+SET LIB=%PSDK%\LIB;%MSVC%\VC98\LIB;%MSVC%\VC98\MFC\LIB
+SET INCLUDE=%PSDK%\INCLUDE;%MSVC%\VC98\INCLUDE;%MSVC%\VC98\MFC\INCLUDE
+
+IF NOT EXIST gui\win32\Shim\Release\*.* MKDIR gui\win32\Shim\Release
+
+CL.EXE /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"gui\win32\Shim\Release\Shim.pch" /YX /Fo"gui\win32\Shim\Release\\" /Fd"gui\win32\Shim\Release\\" /FD /c "gui\win32\Shim\shim.c"
+LINK.EXE kernel32.lib user32.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"gui\win32\Shim\Release\Shim.exe" "gui\win32\Shim\Release\shim.obj"
+
+IF NOT EXIST gui\win32\Main\Release\*.* MKDIR gui\win32\Main\Release
+
+RC.EXE /l 0x407 /fo"gui\win32\Main\Release\Frontend.res" /d NDEBUG "gui\win32\Main\Frontend.rc"
+CL.EXE /I"src" /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"gui\win32\Main\Release\Frontend.pch" /YX"stdafx.h" /Fo"gui\win32\Main\Release\\" /Fd"gui\win32\Main\Release\\" /FD /c "gui\win32\Main\Frontend.cpp" "gui\win32\Main\FrontendDlg.cpp" "gui\win32\Main\HnaEntry.cpp" "gui\win32\Main\MidEntry.cpp" "gui\win32\Main\MprEntry.cpp" "gui\win32\Main\MyDialog1.cpp" "gui\win32\Main\MyDialog2.cpp" "gui\win32\Main\MyDialog3.cpp" "gui\win32\Main\MyDialog4.cpp" "gui\win32\Main\MyEdit.cpp" "gui\win32\Main\MyTabCtrl.cpp" "gui\win32\Main\NodeEntry.cpp" "gui\win32\Main\StdAfx.cpp" "gui\win32\Main\TrayIcon.cpp"
+LINK.EXE ws2_32.lib iphlpapi.lib gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res /nologo /subsystem:windows /incremental:no /machine:I386 /out:"gui\win32\Main\Release\Switch.exe" "gui\win32\Main\Release\Frontend.obj" "gui\win32\Main\Release\FrontendDlg.obj" "gui\win32\Main\Release\HnaEntry.obj" "gui\win32\Main\Release\MidEntry.obj" "gui\win32\Main\Release\MprEntry.obj" "gui\win32\Main\Release\MyDialog1.obj" "gui\win32\Main\Release\MyDialog2.obj" "gui\win32\Main\Release\MyDialog3.obj" "gui\win32\Main\Release\MyDialog4.obj" "gui\win32\Main\Release\MyEdit.obj" "gui\win32\Main\Release\MyTabCtrl.obj" "gui\win32\Main\Release\NodeEntry.obj" "gui\win32\Main\Release\StdAfx.obj" "gui\win32\Main\Release\TrayIcon.obj"
+
+MAKENSIS.EXE gui\win32\Inst\installer.nsi