%global commit_ocamllibs 7a83e902634e1db204f6e3a48c2439f63d83c141
%global commit_haxelib 4fefbd17a2d9a98200b621de801018af3896d68a
Name: haxe
Version: 3.2.1
Release: 3%{?dist}
Summary: Multi-target universal programming language
# As described in http://haxe.org/foundation/open-source.html:
# * The Haxe Compiler - GPLv2+
# * The Haxe Standard Library - MIT
# * The Neko Runtime Library - LGPLv2+
#
# The source files:
# * All files in the std folder is MIT licensed, except:
# * std/cs/_std/haxe/ds/IntMap.hx - BSD (2 clause)
# * std/haxe/xml/Printer.hx - BSD (3 clause)
# * Ocamllibs in the libs folder:
# * the zlib headers in libs/extc/zlib - zlib
# * extc, ilib, javalib, neko, swflib - GPLv2+
# * everything else - LGPLv2.1+
License: GPLv2+ and MIT and LGPLv2+ and BSD
URL: http://www.haxe.org/
Source0: https://github.com/HaxeFoundation/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://github.com/HaxeFoundation/ocamllibs/archive/%{commit_ocamllibs}.tar.gz#/ocamllibs-%{commit_ocamllibs}.tar.gz
Source2: https://github.com/HaxeFoundation/haxelib/archive/%{commit_haxelib}.tar.gz#/haxelib-%{commit_haxelib}.tar.gz
BuildRequires: nekovm >= 2.0.0
BuildRequires: ocaml
BuildRequires: ocaml-camlp4-devel
BuildRequires: zlib-devel
BuildRequires: help2man
Requires: nekovm >= 2.0.0
Requires: %{name}-stdlib = %{version}
%description
Haxe is an open source toolkit based on a modern,
high level, strictly typed programming language, a cross-compiler,
a complete cross-platform standard library and ways to access each
platform's native capabilities.
%package stdlib
Summary: The Haxe standard library
BuildArch: noarch
%description stdlib
The %{name}-stdlib package contains the standard library used
by the Haxe compiler.
%prep
%setup -q
pushd libs && tar -xf %{SOURCE1} --strip-components=1 && popd
pushd extra/haxelib_src && tar -xf %{SOURCE2} --strip-components=1 && popd
# script-without-shebang
# https://github.com/HaxeFoundation/haxe/commit/7ecbc2baaef0e2f653f43b01071ffff0050ec5d3
chmod a-x std/js/Boot.hx std/js/_std/Type.hx std/php/_std/haxe/ds/StringMap.hx
chmod a-x libs/extlib/extList.ml
%build
# note that the Makefile does not support parallel building
# Check to see if ocamlopt exists. If not, bytecompile everything.
# It is because ocamlopt may be missing in some architectures.
command -v ocamlopt && make || make BYTECODE=1
# Compile haxelib
make tools
chmod 755 haxe haxelib
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -p haxe %{buildroot}%{_bindir}
cp -p haxelib %{buildroot}%{_bindir}
cp -rfp std %{buildroot}%{_datadir}/%{name}
# Generate man pages
mkdir -p %{buildroot}%{_mandir}/man1
help2man ./haxe --version-option=-version --no-discard-stderr --no-info --output=%{buildroot}%{_mandir}/man1/haxe.1
help2man ./haxelib --help-option=help --version-option=version --no-info --output=%{buildroot}%{_mandir}/man1/haxelib.1
%check
%{buildroot}%{_bindir}/haxe -version
pushd tests/unit && %{buildroot}%{_bindir}/haxe compile-macro.hxml && popd
%files
%doc README.md
%license extra/LICENSE.txt
%{_bindir}/haxe
%{_bindir}/haxelib
%{_mandir}/man1/haxe.1*
%{_mandir}/man1/haxelib.1*
%files stdlib
%doc README.md
%license extra/LICENSE.txt
%{_datadir}/%{name}/
%changelog
* Thu Jun 09 2016 Andy Li <andy@onthewings.net> - 3.2.1-3
- Rebuilt against nekovm 2.1.0
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Oct 07 2015 Andy Li <andy@onthewings.net> - 3.2.1-1
- Initial RPM release