Files
basil00_WinDivert/mingw-build.sh
T
basil00 38f1f3a16d - Towards WinDivert 1.1:
* Re-brand "DIVERT" to "WINDIVERT" throughout the code-base.
* New flags:
  > WINDIVERT_FLAG_PASSTHRU: Do not drop nor capture packets.  Useful
    for injection-only handles.
  > WINDIVERT_FLAG_NO_CHECKSUM: Do not guarantee that diverted packets
    have a correct checksum.
  NOTE: Not yet tested!
* New default values and limits for various WinDivert parameters,
  including WINDIVERT_PARAM_QUEUE_LEN, WINDIVERT_PARAM_QUEUE_TIME, and
  the maximum filter length.
* New extended WinDivert functions that support asynchronous I/O:
  > WinDivertRecvEx(..)
  > WinDivertSendEx(..)
  NOTE: Not yet tested!
* The WinDivert driver now services reads (receives) out-of-band.
  The motivation is because WFP callouts are run at DISPATCH_LEVEL, so
  we should not be doing expensive work in the ClassifyFn.  This is also
  the same reason why the filter length has been restricted.
2013-06-30 15:58:21 +08:00

78 lines
2.9 KiB
Bash

#!/bin/bash
#
# mingw-build.sh
# (C) 2013, all rights reserved,
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Script for MinGW/Linux cross compilation.
# NOTE: run wddk-build.bat before this script.
set -e
ENVS="i686-w64-mingw32 x86_64-w64-mingw32"
for ENV in $ENVS
do
if [ $ENV = "i686-w64-mingw32" ]
then
CPU=i386
else
CPU=amd64
fi
if [ ! -d install/WDDK/$CPU ]
then
echo "WARNING: missing WDDK build; run wddk-build.bat first"
echo "SKIP WDDK-$CPU"
continue
fi
echo "BUILD WDDK-$CPU"
CC="$ENV-gcc"
STRIP="$ENV-strip"
if [ -x "`which $CC`" ]
then
echo "\tmake install/MINGW/$CPU..."
mkdir -p "install/MINGW/$CPU"
echo "\tbuild install/MINGW/$CPU/WinDivert.dll..."
$CC -Wall -O2 -Iinclude/ -c dll/windivert.c -o dll/windivert.o
$CC -Wall -shared -o "install/MINGW/$CPU/WinDivert.dll" dll/windivert.o
$STRIP --strip-debug "install/MINGW/$CPU/WinDivert.dll"
echo "\tbuild install/MINGW/$CPU/netdump.exe..."
$CC -s -O2 -Iinclude/ examples/netdump/netdump.c \
-o "install/MINGW/$CPU/netdump.exe" -lWinDivert -lws2_32 \
-L"install/MINGW/$CPU/"
echo "\tbuild install/MINGW/$CPU/netfilter.exe..."
$CC -s -O2 -Iinclude/ examples/netfilter/netfilter.c \
-o "install/MINGW/$CPU/netfilter.exe" -lWinDivert -lws2_32 \
-L"install/MINGW/$CPU/"
echo "\tbuild install/MINGW/$CPU/passthru.exe..."
$CC -s -O2 -Iinclude/ examples/passthru/passthru.c \
-o "install/MINGW/$CPU/passthru.exe" -lWinDivert -lws2_32 \
-L"install/MINGW/$CPU/"
echo "\tbuild install/MINGW/$CPU/webfilter.exe..."
$CC -s -O2 -Iinclude/ examples/webfilter/webfilter.c \
-o "install/MINGW/$CPU/webfilter.exe" -lWinDivert -lws2_32 \
-L"install/MINGW/$CPU/"
echo "\tcopy install/MINGW/$CPU/WinDivert.inf..."
cp install/WDDK/$CPU/WinDivert.inf install/MINGW/$CPU
echo "\tcopy install/MINGW/$CPU/WinDivert.sys..."
cp install/WDDK/$CPU/WinDivert.sys install/MINGW/$CPU
echo "\tcopy install/MINGW/$CPU/WdfCoInstaller01009.dll..."
cp install/WDDK/$CPU/WdfCoInstaller01009.dll install/MINGW/$CPU
else
echo "WARNING: $CC not found"
fi
done