From 3890eb1f333cf26bdc8a71b767d66ffae7787ae3 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 30 Sep 2013 13:31:37 -0700 Subject: [PATCH] Generate files from .in files before compilation --- libsodium.vcxproj | 16 ++++++++++++++++ msvc-scripts/process.bat | 8 ++++++++ msvc-scripts/rep.vbs | 12 ++++++++++++ 3 files changed, 36 insertions(+) create mode 100755 msvc-scripts/process.bat create mode 100644 msvc-scripts/rep.vbs diff --git a/libsodium.vcxproj b/libsodium.vcxproj index 0148d71b..f3823a87 100644 --- a/libsodium.vcxproj +++ b/libsodium.vcxproj @@ -179,6 +179,10 @@ Console true + + $(SolutionDir)msvc-scripts\process.bat + Process .in files + @@ -195,6 +199,10 @@ Console true + + $(VC_SourcePath)/msvc-scripts/process.bat + Process .in files + @@ -248,6 +256,10 @@ true true + + $(VC_SourcePath)/msvc-scripts/process.bat + Process .in files + @@ -269,6 +281,10 @@ true true + + $(VC_SourcePath)/msvc-scripts/process.bat + Process .in files + diff --git a/msvc-scripts/process.bat b/msvc-scripts/process.bat new file mode 100755 index 00000000..323aa7f7 --- /dev/null +++ b/msvc-scripts/process.bat @@ -0,0 +1,8 @@ +cscript msvc-scripts/rep.vbs //Nologo s/@HAVE_TI_MODE_V@/0/ < src\libsodium\include\sodium\crypto_scalarmult_curve25519.h.in > src\libsodium\include\sodium\crypto_scalarmult_curve25519.h + +cscript msvc-scripts/rep.vbs //Nologo s/@HAVE_AMD64_ASM_V@/0/ < src\libsodium\include\sodium\crypto_stream_salsa20.h.in > src\libsodium\include\sodium\crypto_stream_salsa20.h + +cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/0.4.3/ < src\libsodium\include\sodium\version.h.in > tmp +cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/4/ < tmp > tmp2 +cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/3/ < tmp2 > src\libsodium\include\sodium\version.h +del tmp tmp2 diff --git a/msvc-scripts/rep.vbs b/msvc-scripts/rep.vbs new file mode 100644 index 00000000..3611f6ca --- /dev/null +++ b/msvc-scripts/rep.vbs @@ -0,0 +1,12 @@ +Dim pat, patparts, rxp, inp +pat = WScript.Arguments(0) +patparts = Split(pat, "/") +Set rxp = new RegExp +rxp.Global = True +rxp.Multiline = False +rxp.Pattern = patparts(1) +Do While Not WScript.StdIn.AtEndOfStream + inp = WScript.StdIn.ReadLine() + WScript.Echo rxp.Replace(inp, patparts(2)) +Loop +