# Default to self-hosted routine builds (with bootstrap disabled). # Use --with bootstrap for initial cold-start bootstrap in Koji side-tags. %bcond_with bootstrap %bcond_without doc %bcond_without check %global previous_version 1.21.0 Name: crystal-lang Version: 1.21.1 Release: %autorelease Summary: The Crystal Programming Language License: Apache-2.0 URL: https://crystal-lang.org Source0: https://github.com/crystal-lang/crystal/archive/%{version}/crystal-%{version}.tar.gz # Bootstrap seed tarballs (only used when --with bootstrap is enabled) %if %{with bootstrap} Source4: https://github.com/crystal-lang/crystal/releases/download/%{version}/crystal-%{version}-1-linux-x86_64.tar.gz Source5: https://github.com/crystal-lang/crystal/releases/download/%{version}/crystal-%{version}-1-linux-aarch64.tar.gz %endif # Upstream cherry-pick from PR #17321 (merged for 1.22.0) # Fixes HTTP::Client IPv6 TLS hostname bracket verification under OpenSSL 4.0 # https://github.com/crystal-lang/crystal/pull/17321 Patch0: crystal-1.21.0-fix-http-client-ipv6-tls-hostname.patch ExclusiveArch: x86_64 aarch64 BuildRequires: file BuildRequires: findutils %if 0%{?rhel} BuildRequires: gc-devel >= 7.6.0 %else BuildRequires: gc-devel >= 8.2.0 %endif BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: git-core BuildRequires: gmp-devel BuildRequires: hostname BuildRequires: libedit-devel BuildRequires: libevent-devel BuildRequires: libffi-devel BuildRequires: libunwind-devel BuildRequires: libxml2-devel BuildRequires: libyaml-devel BuildRequires: lld BuildRequires: llvm-devel >= 15 BuildRequires: make BuildRequires: openssl-devel BuildRequires: pcre2-devel BuildRequires: pkgconf-pkg-config BuildRequires: pkgconfig(bash-completion) BuildRequires: rubygem-asciidoctor BuildRequires: tar BuildRequires: xz BuildRequires: zlib-devel %if ! %{with bootstrap} BuildRequires: crystal >= %{previous_version} %endif %description Crystal is a general-purpose, object-oriented programming language designed for developer productivity and execution performance. It features Ruby-inspired syntax, static type inference, automated memory management via the Boehm-Demers- Weiser garbage collector, compile-time macros, and direct native machine code generation via LLVM. %package -n crystal Summary: The Crystal Programming Language %if 0%{?rhel} Requires: gc-devel%{?_isa} >= 7.6.0 %else Requires: gc-devel%{?_isa} >= 8.2.0 %endif Requires: gcc Requires: libevent-devel%{?_isa} Requires: lld Requires: pcre2-devel%{?_isa} Requires: pkgconf-pkg-config Recommends: gmp-devel%{?_isa} Recommends: libxml2-devel%{?_isa} Recommends: libyaml-devel%{?_isa} Recommends: openssl-devel%{?_isa} Recommends: shards Recommends: zlib-devel%{?_isa} Provides: crystal = %{version}-%{release} Provides: crystal%{?_isa} = %{version}-%{release} %description -n crystal Crystal is a general-purpose, object-oriented programming language designed for developer productivity and execution performance. It features Ruby-inspired syntax, static type inference, automated memory management via the Boehm-Demers- Weiser garbage collector, compile-time macros, and direct native machine code generation via LLVM. %if %{with doc} %package docs Summary: API documentation for the Crystal Programming Language BuildArch: noarch Requires: crystal = %{version}-%{release} %description docs This package provides the offline HTML API documentation for the Crystal programming language standard library. %endif %package samples Summary: Sample code for the Crystal Programming Language BuildArch: noarch Requires: crystal = %{version}-%{release} %description samples This package provides example programs and sample code demonstrating the syntax and capabilities of the Crystal programming language. %prep %autosetup -n crystal-%{version} -p1 %if %{with bootstrap} %ifarch x86_64 tar -xzf %{SOURCE4} -C . %endif %ifarch aarch64 tar -xzf %{SOURCE5} -C . %endif %endif %build %if %{with bootstrap} bootstrap="$(readlink -f ./crystal-%{version}*)" binarydir=$(find "$bootstrap" -name crystal -type f -executable -exec sh -c "file -i '{}' | grep -q 'charset=binary'" \; -print0 | xargs -0 dirname) export PATH="$binarydir:$PATH" %endif export release=1 export verbose=1 export threads=%{_smp_build_ncpus} export interpreter=1 export CXXFLAGS="%optflags" export LLVM_CONFIG=$(find %{_bindir} -name "llvm-config*" -print -quit) make \ CRYSTAL_CONFIG_PATH="lib:%{_datadir}/crystal/shards:%{_datadir}/crystal/src" \ CRYSTAL_CONFIG_LIBRARY_PATH="%{_libdir}" %if %{with doc} make docs \ CRYSTAL_CONFIG_PATH="lib:%{_datadir}/crystal/shards:%{_datadir}/crystal/src" \ CRYSTAL_CONFIG_LIBRARY_PATH="%{_libdir}" %endif %install %make_install \ PREFIX=%{_prefix} \ MANDIR=%{_mandir} # Ensure Crystal shared directories exist mkdir -p %{buildroot}%{_datadir}/crystal %if %{with doc} # Install API documentation mkdir -p %{buildroot}%{_datadir}/crystal/docs cp -a docs/* %{buildroot}%{_datadir}/crystal/docs/ %endif # Install sample code mkdir -p %{buildroot}%{_datadir}/crystal/samples cp -a samples/* %{buildroot}%{_datadir}/crystal/samples/ %check %if %{with check} # Remove socket tests requiring multicast/network routing in isolated build chroots rm -f spec/std/socket/udp_socket_spec.cr make std_spec \ CRYSTAL_CONFIG_PATH="lib:%{_datadir}/crystal/shards:%{_datadir}/crystal/src" \ CRYSTAL_CONFIG_LIBRARY_PATH="%{_libdir}" %endif %pretrans -n crystal if [ -d %{_datadir}/crystal/src/lib_c/aarch64-android ]; then mv %{_datadir}/crystal/src/lib_c/aarch64-android %{_datadir}/crystal/src/lib_c/aarch64-android.rpmmoved fi %files -n crystal %license LICENSE %doc CHANGELOG.md README.md %{_bindir}/crystal %{_mandir}/man1/crystal*.1* %dir %{_datadir}/crystal %{_datadir}/crystal/src %{_datadir}/bash-completion/completions/crystal %{_datadir}/zsh/site-functions/_crystal %{_datadir}/fish/vendor_completions.d/crystal.fish %if %{with doc} %files docs %license LICENSE %dir %{_datadir}/crystal/docs %{_datadir}/crystal/docs/* %endif %files samples %license LICENSE %dir %{_datadir}/crystal/samples %{_datadir}/crystal/samples/* %changelog %autochangelog