From 993668bbadb07a6c9444a7dd9a25fb7185d2ba2a Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Sun, 1 Mar 2020 19:46:53 +0100 Subject: [PATCH] In the beginning there was darkness --- VERIFICATION.txt | 3 ++ build.ps1 | 82 +++++++++++++++++++++++++++++++++++++++++ chicken.nuspec | 26 +++++++++++++ chocolateyInstall.ps1 | 5 +++ chocolateyUninstall.ps1 | 3 ++ update.ps1 | 16 ++++++++ 6 files changed, 135 insertions(+) create mode 100644 VERIFICATION.txt create mode 100644 build.ps1 create mode 100644 chicken.nuspec create mode 100644 chocolateyInstall.ps1 create mode 100644 chocolateyUninstall.ps1 create mode 100644 update.ps1 diff --git a/VERIFICATION.txt b/VERIFICATION.txt new file mode 100644 index 0000000..18e24a8 --- /dev/null +++ b/VERIFICATION.txt @@ -0,0 +1,3 @@ +This package was compiled from source for Chocolatey by Daniel Ziltener . + +The script used to build the package can be found at https://gitea.lyrion.ch/zilti/chicken. diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..4400d5a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,82 @@ +#Set-Variable -Name "version" -Value "4.12.0" +$version = '5.2.0' +$binaryversion=11 + +# Preventive cleanup +Remove-Item -Recurse -Force chickenbuild +Remove-Item -Force chicken.*.nupkg +Remove-Item -Recurse -Force chicken-* + +# Fetching and unpacking remote files +Install-Module -Name 7Zip4Powershell -Force -Scope CurrentUser +choco install -y msys2 +Invoke-WebRequest -UseBasicParsing -Uri "https://code.call-cc.org/releases/$version/chicken-$version.tar.gz" -OutFile '.\chicken.tar.gz' +#Expand-7Zip chicken.tar.gz -TargetPath '.\' +#Expand-7Zip chicken.tar -TargetPath '.\' +7z x chicken.tar.gz +7z x chicken.tar +Remove-Item -Force chicken.tar.gz +Remove-Item -Force chicken.tar +mv chicken-* chickenbuild + +# Building +C:\tools\msys64\usr\bin\bash.exe --login -c 'pacboy -Sy --needed --noconfirm binutils:x make:x gcc:x gettext:x readline:x' +$env:Path+=";C:\tools\msys64\mingw64\bin" +mingw32-make.exe -C chickenbuild PLATFORM=mingw ARCH=x86-64 PREFIX=C:/tools/chicken +choco new chicken --version $version --maintainername="'Daniel Ziltener'" +Remove-Item -Recurse -Force chicken\tools\ +Remove-Item -Force chicken\ReadMe.md + +# Copying files +$bindir="chicken\tools\bin" +New-Item $bindir -ItemType Directory +Copy-Item chickenbuild\LICENSE chicken\LICENSE.txt +Copy-Item VERIFICATION.txt chicken\VERIFICATION.txt +Copy-Item chickenbuild\*.exe $bindir +Copy-Item chickenbuild\*.bat $bindir +Copy-Item chickenbuild\*.dll $bindir +$includedir="chicken\tools\include\chicken" +New-Item $includedir -ItemType Directory +Copy-Item chickenbuild\chicken.h $includedir +Copy-Item chickenbuild\chicken-config.h $includedir +$linkerlibdir="chicken\tools\lib" +New-Item $linkerlibdir -ItemType Directory +Copy-Item chickenbuild\libchicken.a $linkerlibdir +Copy-Item chickenbuild\libchicken.dll.a $linkerlibdir +$extbindir="chicken\tools\lib\chicken\9" +New-Item $extbindir -ItemType Directory +Copy-Item chickenbuild\*.so $extbindir +Copy-Item chickenbuild\*.db $extbindir +$docdir="chicken\tools\share\chicken\doc" +New-Item $docdir -ItemType Directory +Copy-Item chickenbuild\chicken.png $docdir +Copy-Item chickenbuild\feathers.tcl $docdir +Copy-Item chickenbuild\LICENSE $docdir +Copy-Item chickenbuild\README $docdir +Copy-Item chickenbuild\manual-html $docdir\manual-html -Recurse + +$man1dir="chicken\tools\man1" +New-Item $man1dir -ItemType Directory +Copy-Item chickenbuild\*.1 $man1dir + +Copy-Item chickenbuild\setup.defaults chicken\tools\share\chicken + +Copy-Item chocolateyInstall.ps1 .\chicken\ +Copy-Item chocolateyUninstall.ps1 .\chicken\ + +# Create ignorefiles to prevent creation of shims +$files = get-childitem "chicken" -include *.exe -recurse +cd chicken +foreach ($file in $files) { + #generate an ignore file + New-Item "$file.ignore" -type file -force | Out-Null +} +cd .. +# Cleanup and packaging +Remove-Item -Recurse -Force chickenbuild +(Get-Content chicken.nuspec).replace("CHICKEN_VERSION", "$version") | Set-Content chicken\chicken.nuspec +cd chicken +choco pack +cd .. +mv .\chicken\chicken.$version.nupkg .\ +Remove-Item -Recurse -Force chicken diff --git a/chicken.nuspec b/chicken.nuspec new file mode 100644 index 0000000..340b383 --- /dev/null +++ b/chicken.nuspec @@ -0,0 +1,26 @@ + + + + chicken + 5.2.0 + Chicken Scheme + Felix Winkelmann, Peter Bex, Evan Hanson + Daniel Ziltener + https://opensource.org/licenses/BSD-3-Clause + http://www.call-cc.org + http://wiki.call-cc.org/chicken-small.png + true + CHICKEN is a compiler for the Scheme programming language. It produces portable and efficient C and supports the R5RS and R7RS (work in progress) standards, and many extensions. It runs on Linux, OS X, Windows, many Unix flavours, and aims to be + free, simple, portable, extensible, well documented and actively supported. + CHICKEN is a compiler for the Scheme programming language. + chicken admin scheme lisp programming language + https://code.call-cc.org/cgi-bin/gitweb.cgi?p=chicken-core.git;a=summary + https://bitbucket.org/zilti/chicken + http://wiki.call-cc.org/man/4/The%20User%27s%20Manual + http://lists.nongnu.org/mailman/listinfo/chicken-users + http://bugs.call-cc.org/ + + + + + diff --git a/chocolateyInstall.ps1 b/chocolateyInstall.ps1 new file mode 100644 index 0000000..a079520 --- /dev/null +++ b/chocolateyInstall.ps1 @@ -0,0 +1,5 @@ +New-Item C:\tools -ItemType Directory +Move-Item $env:chocolateyPackageFolder\tools C:\tools\chicken -Force +Install-ChocolateyEnvironmentVariable -VariableName "CHICKEN_PREFIX" -VariableValue "C:\tools\chicken" -VariableType Machine +Install-ChocolateyPath -PathToInstall "C:\tools\chicken\bin" -PathType Machine +Update-SessionEnvironment diff --git a/chocolateyUninstall.ps1 b/chocolateyUninstall.ps1 new file mode 100644 index 0000000..70cda8f --- /dev/null +++ b/chocolateyUninstall.ps1 @@ -0,0 +1,3 @@ +Remove-Item -Recurse -Force "C:\tools\chicken" +Uninstall-ChocolateyEnvironmentVariable -VariableName "CHICKEN_PREFIX" -VariableType Machine +Update-SessionEnvironment diff --git a/update.ps1 b/update.ps1 new file mode 100644 index 0000000..ecdb104 --- /dev/null +++ b/update.ps1 @@ -0,0 +1,16 @@ +function global:au_GetLatest { + $download_page = Invoke-WebRequest -UseBasicParsing -Uri 'http://code.call-cc.org/' + $url = $download_page.links | ? href -Match '.tar\.gz$' | select -First 1 -Expand href + $version = $url -Split '-|.tar.gz' | select -Last 1 -Skip 1 + return @{ Version = $version; URL = $url } +} + +function global:au_SearchReplace { + @{ + "build.ps1" = @{ + "(^[$]version\s*=\s*)('.*')" = "`$1'$($Latest.Version)'" + } + } +} + +Update-Package \ No newline at end of file