|
| 1 | +@echo off |
| 2 | +call :%* |
| 3 | +goto :eof |
| 4 | + |
| 5 | +:perl_setup |
| 6 | +if not defined perl_type set perl_type=strawberry |
| 7 | +cinst -y curl |
| 8 | +if "%perl_type%" == "cygwin" ( |
| 9 | + start /wait c:\cygwin\setup-x86.exe -q -g -P perl -P binutils -P make -P gcc -P gcc-core -P gcc-g++ -P make -P pkg-config -P libcrypt-devel -P openssl-devel -P curl |
| 10 | + set "PATH=C:\cygwin\usr\local\bin;C:\cygwin\bin;%PATH%" |
| 11 | +) else if "%perl_type%" == "strawberry" ( |
| 12 | + if not defined perl_version ( |
| 13 | + cinst -y StrawberryPerl |
| 14 | + ) else ( |
| 15 | + cinst -y StrawberryPerl --version %perl_version% |
| 16 | + ) |
| 17 | + if errorlevel 1 ( |
| 18 | + type C:\ProgramData\chocolatey\logs\chocolatey.log |
| 19 | + exit /b 1 |
| 20 | + ) |
| 21 | + set "PATH=C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;%PATH%" |
| 22 | +) else ( |
| 23 | + echo.Unknown perl type "%perl_type%"! 1>&2 |
| 24 | + exit /b 1 |
| 25 | +) |
| 26 | +for /f "usebackq delims=" %%d in (`perl -MConfig -e"print $Config{make}"`) do set "make=%%d" |
| 27 | +set "perl=perl" |
| 28 | +set "cpanm=call .appveyor.cmd cpanm" |
| 29 | +set "cpan=%perl% -S cpan" |
| 30 | +set TAR_OPTIONS=--warning=no-unknown-keyword |
| 31 | +goto :eof |
| 32 | + |
| 33 | +:cpanm |
| 34 | +%perl% -S cpanm >NUL 2>&1 |
| 35 | +if ERRORLEVEL 1 ( |
| 36 | + curl -V >NUL 2>&1 |
| 37 | + if ERRORLEVEL 1 cinst -y curl |
| 38 | + curl -k -L https://cpanmin.us/ -o "%TEMP%\cpanm" |
| 39 | + %perl% "%TEMP%\cpanm" -n App::cpanminus |
| 40 | +) |
| 41 | +set "cpanm=%perl% -S cpanm" |
| 42 | +%cpanm% %* |
| 43 | +goto :eof |
| 44 | + |
| 45 | +:local_lib |
| 46 | +if "%perl_type%" == "cygwin" goto :local_lib_cygwin |
| 47 | +%perl% -Ilib -Mlocal::lib=--shelltype=cmd %* > %TEMP%\local-lib.bat |
| 48 | +call %TEMP%\local-lib.bat |
| 49 | +del %TEMP%\local-lib.bat |
| 50 | +goto :eof |
| 51 | + |
| 52 | +:local_lib_cygwin |
| 53 | +for /f "usebackq delims=" %%d in (`sh -c "cygpath -w $HOME/perl5"`) do ( |
| 54 | + c:\perl\bin\perl.exe -Ilib -Mlocal::lib - %%d --shelltype=cmd > "%TEMP%\local-lib.bat" |
| 55 | +) |
| 56 | +setlocal |
| 57 | + call "%TEMP%\local-lib.bat" |
| 58 | +endlocal & set "PATH=%PATH%" |
| 59 | +set "PATH_BACK=%PATH%" |
| 60 | +%perl% -Ilib -Mlocal::lib - --shelltype=cmd > "%TEMP%\local-lib.bat" |
| 61 | +call "%TEMP%\local-lib.bat" |
| 62 | +set "PATH=%PATH_BACK%" |
| 63 | +del "%TEMP%\local-lib.bat" |
| 64 | +goto :eof |
| 65 | + |
| 66 | +:eof |
0 commit comments