From 073ce9a267b7cbab9ff971357bf7e8caf03debbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20H=C3=B6rberg?= Date: Sun, 2 Nov 2025 23:52:52 +0100 Subject: [PATCH] Build Crystal from source, split out shards pkg Build Crystal and shards from source, building dynamically linked binaries. Separate the crystal and shards packages, they have different versions and update schedules. Remove architecture restrictions. Introduce a bootstrap problem, as Crystal is built using Crystal. --- anda/langs/crystal/crystal/anda.hcl | 1 - anda/langs/crystal/crystal/crystal.spec | 68 +++++++++++-------------- anda/langs/crystal/crystal/update.rhai | 10 +--- anda/langs/crystal/shards/anda.hcl | 5 ++ anda/langs/crystal/shards/shards.spec | 34 +++++++++++++ anda/langs/crystal/shards/update.rhai | 1 + 6 files changed, 71 insertions(+), 48 deletions(-) create mode 100644 anda/langs/crystal/shards/anda.hcl create mode 100644 anda/langs/crystal/shards/shards.spec create mode 100644 anda/langs/crystal/shards/update.rhai diff --git a/anda/langs/crystal/crystal/anda.hcl b/anda/langs/crystal/crystal/anda.hcl index d2a5a14455..1ce7a085d6 100644 --- a/anda/langs/crystal/crystal/anda.hcl +++ b/anda/langs/crystal/crystal/anda.hcl @@ -1,5 +1,4 @@ project pkg { - arches = ["x86_64"] rpm { spec = "crystal.spec" } diff --git a/anda/langs/crystal/crystal/crystal.spec b/anda/langs/crystal/crystal/crystal.spec index da28a9d34f..065cbcb33b 100644 --- a/anda/langs/crystal/crystal/crystal.spec +++ b/anda/langs/crystal/crystal/crystal.spec @@ -1,57 +1,49 @@ %define debug_package %nil -Name: crystal +Name: crystal Version: 1.18.2 -Release: 1%?dist -Summary: The Crystal Programming Language +Release: 2%?dist +Summary: A general-purpose, object-oriented programming language License: Apache-2.0 -URL: https://crystal-lang.org/ -Source0: https://github.com/crystal-lang/crystal/releases/download/%version/crystal-%version-1-linux-x86_64-bundled.tar.gz -ExclusiveArch: x86_64 -BuildRequires: rpm_macro(fdupes) +URL: https://crystal-lang.org/ +Source0: https://github.com/crystal-lang/crystal/archive/%version.tar.gz +BuildRequires: crystal gcc gcc-c++ make gc-devel llvm-devel +BuildRequires: pcre2-devel libyaml-devel libffi-devel +Requires: gcc pkgconfig gc-devel +Requires: pcre2-devel openssl-devel zlib-devel +Requires: libyaml-devel libxml2-devel gmp-devel +Suggests: shards %description -%summary. - -%package devel -Summary: Development files for the crystal package - -%description devel -%summary. +Crystal is a programming language with the following goals: +- Have a syntax similar to Ruby (but compatibility with it is not a goal) +- Statically type-checked but without having to specify the type of variables or method arguments +- Be able to call C code by writing bindings to it in Crystal +- Have compile-time evaluation and generation of code, to avoid boilerplate code +- Compile to efficient native code %prep -%autosetup -n crystal-%version-1 +%setup -q %build +make release=1 interpreter=1 LDFLAGS="%{build_ldflags}" CRYSTAL_CONFIG_LIBRARY_PATH=%{_libdir}/crystal %install -mkdir -p %buildroot/usr/bin -mkdir -p %buildroot/usr/share -mkdir -p %buildroot/usr/lib/crystal -install -Dm755 bin/* %buildroot/usr/bin/ -cp -r share/* %buildroot/usr/share/ -cp -r lib/crystal/* %buildroot/usr/lib/crystal/ - -%fdupes %buildroot%_datadir/crystal/src/lib_c/ - +make install DESTDIR=%{buildroot} PREFIX=%{_prefix} %files -%license /usr/share/licenses/crystal/LICENSE -/usr/bin/crystal -/usr/share/zsh/site-functions/_crystal -/usr/share/man/man1/crystal.1.gz -/usr/share/crystal/ -/usr/share/fish/vendor_completions.d/crystal.fish -/usr/share/bash-completion/completions/crystal - -/usr/bin/shards -/usr/share/man/man1/shards.1.gz -/usr/share/man/man5/shard.yml.5.gz - -%files devel -/usr/lib/crystal/ +%license %{_datadir}/licenses/crystal/LICENSE +%{_bindir}/crystal +%{_datadir}/crystal +%{_datadir}/zsh/site-functions/_crystal +%{_datadir}/bash-completion/completions/crystal +%{_datadir}/fish/vendor_completions.d/crystal.fish +%{_mandir}/man1/crystal.1.gz %changelog +* Mon Nov 03 2025 Carl Hörberg - 1.18.2-2 +- Build from source, support multiple architectures. + * Sat Jun 17 2023 windowsboy111 - 1.8.2-2 - Add devel package. diff --git a/anda/langs/crystal/crystal/update.rhai b/anda/langs/crystal/crystal/update.rhai index b2159a6775..8a0aa8cee3 100644 --- a/anda/langs/crystal/crystal/update.rhai +++ b/anda/langs/crystal/crystal/update.rhai @@ -1,9 +1 @@ -let v = gh("crystal-lang/crystal"); -let url = `crystal-${v}-1-linux-x86_64-bundled.tar.gz`; - -if get(`https://github.com/crystal-lang/crystal/releases/expanded_assets/${v}`).contains(url) { - rpm.version(v); -} else { - print(`crystal: ${v} (waiting for bundle)`); - terminate(); -} +rpm.version(gh_tag("crystal-lang/crystal")); diff --git a/anda/langs/crystal/shards/anda.hcl b/anda/langs/crystal/shards/anda.hcl new file mode 100644 index 0000000000..32456c8b0f --- /dev/null +++ b/anda/langs/crystal/shards/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "shards.spec" + } +} diff --git a/anda/langs/crystal/shards/shards.spec b/anda/langs/crystal/shards/shards.spec new file mode 100644 index 0000000000..391a0a99ba --- /dev/null +++ b/anda/langs/crystal/shards/shards.spec @@ -0,0 +1,34 @@ +%define debug_package %nil + +Name: shards +Version: 0.19.1 +Release: 1%?dist +Summary: Dependency manager for the Crystal language +License: Apache-2.0 +URL: https://crystal-lang.org/ +Source0: https://github.com/crystal-lang/shards/archive/refs/tags/v%version.tar.gz +BuildRequires: crystal +Requires: git make +Supplements: crystal + +%description +Shards is a dependency manager for the Crystal programming language. It allows you to easily manage and install external libraries (called "shards") that your Crystal projects depend on. + + +%prep +%setup -q + +%build +make release=1 FLAGS="--link-flags=\"%{build_ldflags}\"" + +%install +make install DESTDIR=%{buildroot} PREFIX=%{_prefix} + +%files +%{_bindir}/shards +%{_mandir}/man1/shards.1.gz +%{_mandir}/man5/shard.yml.5.gz + +%changelog +* Mon Nov 03 2025 Carl Hörberg - 0.19.1-1 +- Initial package diff --git a/anda/langs/crystal/shards/update.rhai b/anda/langs/crystal/shards/update.rhai new file mode 100644 index 0000000000..11ba9c5d21 --- /dev/null +++ b/anda/langs/crystal/shards/update.rhai @@ -0,0 +1 @@ +rpm.version(gh_tag("crystal-lang/shards"));