File crystal.spec of Package crystal
%define realname crystal
%define realver 1.9.2
%bcond_without bootstrap
%define bootstrap_version %{realver}
%define bootstrap_arch %_arch
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
%define completions_bash %(pkg-config --variable=completionsdir bash-completion)
# Common info
Name: %{realname}
Version: %{realver}
Release: %{?extraver:0.}1%{?dist}
License: Apache-2.0
Group: Development/Languages/Other
URL: https://crystal-lang.org
Summary: The Crystal Programming Language
# Install-time parameters
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRequires: llvm-devel
BuildRequires: libgc-devel libatomic_ops-devel
BuildRequires: pkgconfig(libpcre)
BuildRequires: pkgconfig(libevent)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(yaml-0.1)
# ATM only for tests
BuildRequires: pkgconfig(libcrypto) pkgconfig(libssl)
# Shell completions
BuildRequires: pkgconfig(bash-completion)
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
%if %{without bootstrap}
BuildRequires: %{realname}
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source0: https://github.com/crystal-lang/crystal/archive/refs/tags/%{version}%{?extraver}.tar.gz#/%{realname}-%{version}%{?extraver}.tar.gz
%if %{with bootstrap}
Source1: https://github.com/crystal-lang/crystal/releases/download/%{bootstrap_version}/crystal-%{bootstrap_version}-1-linux-x86_64.tar.gz
%endif
%description
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.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%if %{with bootstrap}
tar -zxf %{_sourcedir}/crystal-%{bootstrap_version}-1-%{_os}-%{bootstrap_arch}.tar.gz
%endif
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%if %{with bootstrap}
export PATH=$(pwd -P)/crystal-%{bootstrap_version}-1/bin:$PATH
%endif
%{__make} %{?_smp_mflags} \
release=1 \
stats=1 \
progress=1 \
threads=$(getconf _NPROCESSORS_ONLN) \
verbose=1 \
PREFIX=%{_prefix} \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%install
%{__make} install DESTDIR=%{buildroot} \
PREFIX=%{_prefix}
[ "%{buildroot}" != "/" ] && %{__rm} -f %{buildroot}%{_datadir}/licenses/crystal/LICENSE
%if 0%{?suse_version}
%fdupes %{buildroot}%{_datadir}/crystal
%endif
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
#%check
#_CFLAGS='%{optflags} %{?gcc_lto}'
#_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
#export PATH=%{buildroot}%{_bindir}:$PATH
#export CRYSTAL=%{buildroot}%{_libexecdir}/crystal
#%{__make} std_spec compiler_spec \
# CFLAGS="$_CFLAGS" \
# CXXFLAGS="$_CFLAGS" \
# LDFLAGS="$_LDFLAGS -L%{_libdir} $(pkg-config --libs-only-L libssl) $(pkg-config --libs-only-L libcrypto) $(pkg-config --libs-only-L zlib)"
%files
%defattr(-,root,root)
%license LICENSE
%doc CHANGELOG.md CONTRIBUTING.md NOTICE.md README.md SECURITY.md
%doc %{_mandir}/man1/crystal.1*
%{_bindir}/crystal
%{_datadir}/crystal
%dir %{completions_bash}
%{completions_bash}/crystal
%{_datadir}/zsh/site-functions/_crystal
%{_datadir}/fish/vendor_completions.d/crystal.fish
%changelog