Last active
March 4, 2025 21:59
-
-
Save micksmix/f80e176886181f42f9880c88052962df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
##### config ##### | |
CPU_ARCH="x64" # Win32 or x64 | |
PLATFORM="Visual Studio 16 2019" # target platform | |
BOOST_VER="1_87_0" # Boost version | |
# Add path to MSBuild.exe | |
export PATH="$PATH:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin" | |
echo "##### check necessary cmd #####" | |
chk_cmd() { | |
if ! command -v "$1" >/dev/null 2>&1; then | |
echo "Error: $1 is not installed." | |
exit 1 | |
fi | |
} | |
chk_cmd python | |
chk_cmd curl | |
chk_cmd git | |
chk_cmd unzip | |
echo "##### download libraries #####" | |
[ -d hyperscan ] || git clone https://github.com/intel/hyperscan.git | |
download() { | |
local file | |
file=$(basename "$1") | |
[ -e "$file" ] || curl -k -L -O "$1" | |
} | |
download "http://www.colm.net/files/ragel/ragel-6.10.tar.gz" | |
download "https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.bz2" | |
download "http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.41.tar.bz2" | |
download "https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip" | |
download "https://www.sqlite.org/2025/sqlite-amalgamation-3490100.zip" | |
echo "##### extract #####" | |
[ -d cmake-3.31.6-windows-x86_64 ] || unzip -q cmake-3.31.6-windows-x86_64.zip | |
if [ ! -d hyperscan/sqlite3 ]; then | |
unzip -q sqlite-amalgamation-3490100.zip | |
mv sqlite-amalgamation-3490100 hyperscan/sqlite3 | |
fi | |
[ -d ragel-6.10 ] || tar zxf ragel-6.10.tar.gz | |
cd hyperscan | |
[ -d "boost_${BOOST_VER}" ] || tar jxf "../boost_${BOOST_VER}.tar.bz2" | |
[ -d "pcre-8.41" ] || tar jxf "../pcre-8.41.tar.bz2" | |
if ! command -v ragel >/dev/null 2>&1; then | |
echo "##### install ragel #####" | |
pushd ../ragel-6.10 | |
./configure | |
make | |
make install | |
popd | |
fi | |
echo "##### build #####" | |
BOOST_ROOT="$(cygpath -w "$PWD")/boost_${BOOST_VER}" | |
CXXFLAGS="/MP /FS" CFLAGS="/MP /FS" \ | |
../cmake-3.31.6-windows-x86_64/bin/cmake -G "$PLATFORM" -DBOOST_ROOT="$BOOST_ROOT/.." | |
for config in Release Debug; do | |
nice -n 10 MsBuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration="$config" | |
mkdir -p "lib/${CPU_ARCH}.${config}" | |
find lib -maxdepth 1 -type f -exec mv {} "lib/${CPU_ARCH}.${config}" \; | |
done | |
# git clone https://github.com/microsoft/vcpkg.git | |
# cd vcpkg | |
# .\bootstrap-vcpkg.bat | |
# .\vcpkg.exe install hyperscan:x64-windows-static | |
#set LIBHS_NO_PKG_CONFIG=1 | |
#set HYPERSCAN_ROOT=C:\dev\vcpkg\installed\x64-windows-static | |
#cargo build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment