From e6306ea1888ae69131322cf56de1fc61bbf4a7f8 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Thu, 12 Sep 2019 23:18:52 -0500 Subject: [PATCH] Add script for removing on windows. This caused bad stuff to be generated on windows, specifically the amalg file. We cause totally strip from files on windows using this script. --- build_win.bat | 2 ++ tools/amalg.janet | 2 +- tools/removecr.janet | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tools/removecr.janet diff --git a/build_win.bat b/build_win.bat index 2cc7746c..f2ddb738 100644 --- a/build_win.bat +++ b/build_win.bat @@ -98,6 +98,7 @@ for %%f in (src\core\*.c) do ( set "amalg_files=!amalg_files! %%f" ) janet.exe tools\amalg.janet src\core\util.h src\core\state.h src\core\gc.h src\core\vector.h src\core\fiber.h src\core\regalloc.h src\core\compile.h src\core\emit.h src\core\symcache.h %amalg_files% build\core_image.c > build\janet.c +janet.exe tools\removecr.janet build\janet.c echo === Successfully built janet.exe for Windows === echo === Run 'build_win test' to run tests. == @@ -137,6 +138,7 @@ exit /b 0 :DIST mkdir dist janet.exe tools\gendoc.janet > dist\doc.html +janet.exe tools\removecr.janet dist\doc.html copy build\janet.c dist\janet.c copy janet.exe dist\janet.exe diff --git a/tools/amalg.janet b/tools/amalg.janet index c571a7e6..75507ccd 100644 --- a/tools/amalg.janet +++ b/tools/amalg.janet @@ -9,4 +9,4 @@ # Body (each path (tuple/slice (dyn :args) 1) - (print (slurp path))) + (print (slurp path :r))) diff --git a/tools/removecr.janet b/tools/removecr.janet new file mode 100644 index 00000000..305def6b --- /dev/null +++ b/tools/removecr.janet @@ -0,0 +1,9 @@ +# Remove carriage returns from file. Since piping things on +# windows may add bad line endings, we can just force removal +# with this script. +(def fname ((dyn :args) 1)) +(with [f (file/open fname :rb+)] + (def source (:read f :all)) + (def new-source (string/replace-all "\r" "" source)) + (:seek f :set 0) + (:write f new-source))