+crystal-lang.org (#3669)

* add(crystal-lang)

* move to bootstrap

this always hurts

* oops

* linux needs explicit -z

* linux not detecting the compiler well

* Only shim build

* needs ncurses

* shim needs link flags for eval?

* need link flags for test

* maybe what eval needs is --static

* the docs are wrong

* this should do it, i think

* perhaps static linkage

* punt

---------

Co-authored-by: Jacob Heider <jacob@tea.xyz>
Co-authored-by: Jacob Heider <jacob@pkgx.dev>
This commit is contained in:
Julien Elbaz 2023-10-22 08:07:02 +02:00 committed by GitHub
parent 1e8e04f83b
commit b0babf6b46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 146 additions and 0 deletions

View file

@ -0,0 +1,82 @@
distributable:
url: https://github.com/crystal-lang/crystal/archive/refs/tags/{{ version }}.tar.gz
strip-components: 1
versions:
github: crystal-lang/crystal
# Crystal is needed to build itself…
# So we cannot build it from source.
warnings:
- vendored
platforms:
- darwin
- linux/x86-64
companions:
crystal-lang.org/shards: '*'
dependencies:
hboehm.info/gc: ^8
gnu.org/gmp: ^6
libevent.org: ^2
pyyaml.org/libyaml: ^0
llvm.org: <17
openssl.org: ^1.1
pcre.org/v2: ^10
freedesktop.org/pkg-config: ^0
sourceware.org/libffi: ^3
invisible-island.net/ncurses: ^6
runtime:
env:
CRYSTAL_PATH: ${{prefix}}/lib:$CRYSTAL_PATH
CRYSTAL_LIBRARY_PATH: $LD_LIBRARY_PATH
build:
dependencies:
curl.se: '*'
gnu.org/make: '*'
script:
- run: |
curl -Lf "https://github.com/crystal-lang/crystal/releases/download/{{version}}/crystal-{{version}}-1-$PLATFORM.tar.gz" | \
tar --strip-components=1 -zxf -
working-directory: .bootstrap
- mkdir -p .build
- make deps
- make crystal $ARGS
- mkdir -p "{{prefix}}/bin"
- cp .build/crystal "{{prefix}}/bin/crystal.bin"
- cp props/shim "{{prefix}}/bin/crystal"
- cp -a src "{{prefix}}/lib"
env:
CRYSTAL_LIBRARY_PATH: $LD_LIBRARY_PATH
PATH: $SRCROOT/.bootstrap/bin:$PATH
darwin: { PLATFORM: darwin-universal }
linux/x86-64: { PLATFORM: linux-x86_64 }
LDFLAGS: -Wl,-rpath,{{pkgx.prefix}}
ARGS:
- release=true
- FLAGS=--no-debug
- interpreter=true
- CRYSTAL_CONFIG_PATH=../lib
linux:
CC: clang
CXX: clang++
LD: clang
provides:
- bin/crystal
test:
fixture: puts {{Crystal::VERSION}}
env:
CRYSTAL_LINK_FLAGS: -Wl,-rpath,{{pkgx.prefix}}
script:
- cp $FIXTURE test.cr
- crystal build -o test test.cr
- test "$(./test)" = "{{version}}"
# FIXME: this should work, but because it compiles with LLVM, it needs the
# @rpath set somehow.
# - test "$(crystal eval 'puts {{Crystal::VERSION}}')" = "{{version}}"

View file

@ -0,0 +1,55 @@
distributable:
url: https://github.com/crystal-lang/shards/archive/refs/tags/v{{ version }}.tar.gz
strip-components: 1
versions:
github: crystal-lang/shards
platforms:
- darwin
- linux/x86-64
runtime:
env:
CRYSTAL_PATH: ${{prefix}}/lib:$CRYSTAL_PATH
dependencies:
hboehm.info/gc: ^8
pyyaml.org/libyaml: ^0
crystal-lang.org: '*'
build:
dependencies:
curl.se: '*'
script:
- run: |
curl -L https://github.com/crystal-lang/crystal-molinillo/archive/refs/tags/v0.2.0.tar.gz | \
tar --strip-components=2 -zxf -
mkdir -p "{{prefix}}/lib"
cp -a molinillo molinillo.cr "{{prefix}}/lib"
working-directory: .molinillo
- run: |
sed -i.bak \
-e 's/MOLINILLO_VERSION = .*$/MOLINILLO_VERSION = 0.2.0/' \
Makefile
rm Makefile.bak
- make $ARGS bin/shards
- mkdir -p "{{prefix}}/bin"
- install bin/shards "{{prefix}}/bin"
env:
CRYSTAL_LINK_FLAGS: -Wl,-rpath,{{pkgx.prefix}}
CRYSTAL_PATH: ${{prefix}}/lib:$CRYSTAL_PATH
ARGS:
- release=true
- FLAGS=--no-debug
- CRYSTAL={{deps.crystal-lang.org.prefix}}/bin/crystal
- SHARDS=false
provides:
- bin/shards
test:
script: |
out=($(shards --version))
version=${out[1]}
test $version = {{version}}

9
projects/crystal-lang.org/shim Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
cmd="$1"
shift
case "$cmd" in
build) crystal.bin "$cmd" --link-flags "${CRYSTAL_LINK_FLAGS:-}" "$@";;
*) crystal.bin "$cmd" "$@";;
esac