diff options
author | Paul Smith <psmith@gnu.org> | 2022-08-14 15:03:40 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-08-22 21:19:18 -0400 |
commit | 62da1c45e51f90892dd785fbdd42aeff769defb6 (patch) | |
tree | 22128f902eaa5733528334a38bdd17574225e1ad /bootstrap.bat | |
parent | ab31f0b5941721ed2f5ea20c33388caad01bd657 (diff) | |
download | make-git-62da1c45e51f90892dd785fbdd42aeff769defb6.tar.gz |
Fix bootstrap.bat for bootstrapping on Windows
* README.git: Clarify that these methods are lightly tested.
* build_w32.bat: Don't support any config step: fail if not completed.
Move the config steps into bootstrap.bat. Don't print compile lines
by default and add a --verbose option to show them.
* bootstrap.bat: Ensure we have curl and sed before we do anything.
Pull the latest necessary files from gnulib. Create a convert.sed
script that can update the various template files, and update
Basic.mk, config.h.W32, and gmk-default.h.
* tests/run_make_tests.pl: Remove CRLF rather than using chop. If we
run perl in Git for Bash it seems to handle newlines differently.
* tests/scripts/features/temp_stdin: Remove the make copy and close
STDIN so we can delete the temp file on Windows.
* .gitignore: Ignore the convert.sed script.
Diffstat (limited to 'bootstrap.bat')
-rw-r--r-- | bootstrap.bat | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/bootstrap.bat b/bootstrap.bat index 12077fe1..cfba11ec 100644 --- a/bootstrap.bat +++ b/bootstrap.bat @@ -19,16 +19,66 @@ setlocal set "svurl=https://git.savannah.gnu.org/cgit" set "gnuliburl=%svurl%/gnulib.git/plain" +where curl >nul 2>&1 +if ERRORLEVEL 1 ( + echo Cannot find curl: it must be installed for bootstrap + exit /b 1 +) + +where sed >nul 2>&1 +if ERRORLEVEL 1 ( + echo Cannot find sed: it must be installed for bootstrap + echo Hint: you can use the sed provided in the Git for Windows install + exit /b 1 +) + +if exist lib goto Downloads +mkdir lib +if ERRORLEVEL 1 exit /b 1 + +:Downloads +echo -- Downloading Gnulib modules call :Download lib getloadavg.c call :Download lib intprops.h -goto :Done +call :Download lib intprops-internal.h + +echo -- Configuring the workspace +copy /Y gl\lib\*.* lib > nul + +:: Create a sed script to convert templates +if exist convert.sed del /Q convert.sed +echo s,%%PACKAGE%%,make,g > convert.sed +if ERRORLEVEL 1 goto Failed +sed -n "s/^AC_INIT(\[GNU.make\],\[\([0-9.]*\)\].*/s,%%VERSION%%,\1,g/p" configure.ac >> convert.sed +if ERRORLEVEL 1 goto Failed +sed -z -e s/\\\n//g -e "s/[ \t][ \t]*/ /g" -e "s, [^ ]*\.h,,g" -e "s,src/,$(src),g" -e "s,lib/,$(lib),g" Makefile.am | sed -n "s/^\([A-Za-z0-9]*\)_SRCS *= *\(.*\)/s,%%\1_SOURCES%%,\2,/p" >> convert.sed +if ERRORLEVEL 1 goto Failed + +echo - Creating Basic.mk +call sed -f convert.sed Basic.mk.template > Basic.mk +if ERRORLEVEL 1 goto Failed +echo - Creating src\config.h.W32 +call sed -f convert.sed src\config.h.W32.template > src\config.h.W32 +if ERRORLEVEL 1 goto Failed + +echo - Creating src\gmk-default.h +echo static const char *const GUILE_module_defn = ^" \ > src\gmk-default.h +call sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\\/" src\gmk-default.scm >> src\gmk-default.h +if ERRORLEVEL 1 goto Failed +echo ^";>> src\gmk-default.h + +echo. +echo Done. Run build_w32.bat to build GNU make. +goto :EOF :Download -echo Downloading %1\%2 -curl -sS -o %1\%2 "%gnuliburl%/%1/%2" +if exist "%1\%2" goto :EOF +echo - Downloading %1\%2 +curl -sS -o "%1\%2" "%gnuliburl%/%1/%2" if ERRORLEVEL 1 exit /b 1 goto :EOF -:Done -echo Done. Run build_w32.bat to build GNU make. -goto :EOF +:Failed +echo *** Bootstrap failed. +echo Resolve the issue, or use the configured source in the release tarball +exit /b 1 |