File haxe.spec of Package haxe

# spec file for package haxe
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%global commit_ocamllibs ab5be31c6dd1fcd761c2ba16c5d767bcf6792490
%global commit_haxelib a494d8be523e26fcf875e2c33915808dc221e17a

Name:           haxe
Version:        3.4.7
Release:        0
Summary:        Multiplatform programming language
License:        GPL-2.0+ and MIT
Group:          Development/Languages/Other
# As described in
#   * The Haxe Compiler - GPLv2+
#   * The Haxe Standard Library - MIT
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  help2man
BuildRequires:  neko-devel >= 2.2.0
BuildRequires:  neko >= 2.2.0
BuildRequires:  ocaml >= 4.02.3
BuildRequires:  ocaml-camlp4-devel
BuildRequires:  pkgconfig(zlib)
BuildRequires:  pcre-devel-static
BuildRequires:  cmake
Requires:       neko >= 2.2.0

Haxe is a high-level multiplatform programming language and compiler
that can produce applications and source code for many different
platforms from a single code-base. The Haxe compiler can compile Haxe
source code to Adobe Flash SWF files, ActionScript 3, JavaScript,
C++, PHP, C#, Java, Python, Lua, and Neko VM binary files.

%setup -q
pushd libs && tar -xf %{SOURCE1} --strip-components=1 && popd
pushd extra/haxelib_src && tar -xf %{SOURCE2} --strip-components=1 && popd

# note that the Makefile does not support parallel building

# Haxe 3.4.* is not safe-string compatible.
export OCAMLPARAM="safe-string=0,_"

# Check to see if ocamlopt exists. If not, bytecompile everything.
# It is because ocamlopt may be missing in some architectures.
command -v ocamlopt && make libs haxe || make libs haxe BYTECODE=1

# Compile haxelib
pushd extra/haxelib_src && \
%cmake && \
make %{?_smp_mflags} && \
cp haxelib ../../../haxelib

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

%{buildroot}%{_bindir}/haxe -version
%{buildroot}%{_bindir}/haxelib version

%doc extra/LICENSE.txt extra/CHANGES.txt extra/CONTRIB.txt

openSUSE Build Service is sponsored by