-
Notifications
You must be signed in to change notification settings - Fork 6
/
grep-3.11-build.txt
28 lines (24 loc) · 1.66 KB
/
grep-3.11-build.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
How to build native 32/64-bit Gnu grep.exe with Visual Studio 2022 and WDK10
First, build pcre2.a and pcre2posix.a libraries - see pcre2/pcre2-10.42-build.txt
Second, in the directory containing ./pcre2-pcre2-10.42, build Gnu Grep with PCRE support.
From CYGWIN shell or other unix-like shell:
1) get grep archive: wget https://ftp.gnu.org/gnu/grep/grep-3.11.tar.xz
2) unpack sed archive: tar xf grep-3.11.tar.xz
3) go to grep sources: cd grep-3.11
4) run dos prompt: cmd /c start cmd.exe
5) setup compiler:
for 64-bit build: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
for 32-bit build: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86
6) temporary run sh: sh
7) copy build patch:
for 64-bit build: cp ../grep-3.11-build-VS22-x64.patch ./build.patch
for 32-bit build: cp ../grep-3.11-build-VS22-x86.patch ./build.patch
8) fix build patch - change paths to locations of Visual Studio 2022 and WDK10:
sed -i '/Visual Studio/s@.:.*include@'"$(env | sed -n 's@\\@\\\\@g;/^INCLUDE/s@.*[=;]\([^=;]*\\\\VC\\\\[^=;]*[0-9]\\\\include\).*$@\1@p')"'@' ./build.patch
sed -i '/Windows Kits/s@.:.*ucrt@'"$(env | sed -n 's@\\@\\\\@g;/^INCLUDE/s@.*[=;]\([^=;]*\\\\ucrt\).*$@\1@p')"'@' ./build.patch
9) patch grep: patch -Np1 -i ./build.patch
10) optionally, add support for inline utf16->utf8 transcoding:
patch -Np1 -i ../grep-3.11-utf16.patch
11) exit sh: exit
12) do compile: make.bat
13) check build result: grep.exe --version