File julia.spec of Package julia

#
# spec file for package julia
#
# Copyright (c) 2015 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 http://bugs.opensuse.org/
#


Name:           julia
Version:        0.3.11
Release:        0
%define rmath_ver 226598f
%define libuv_ver abcbb0c
%define llvm_ver  3.3
Summary:        High-level, high-performance dynamic programming language
License:        MIT and GPL-2.0+
Group:          Development/Languages/Other
Url:            http://julialang.org/

Source0:        https://github.com/JuliaLang/julia/archive/v%{version}.tar.gz#/julia-%{version}.tar.gz
Source1:        juliabuildopts
# external sources
Source10:       libuv-%{libuv_ver}.tar.gz
Source11:       Rmath-%{rmath_ver}.tar.gz
Source12:       http://llvm.org/releases/%{llvm_ver}/llvm-%{llvm_ver}.src.tar.gz
# PATCH-FIX-OPENSUSE julia-disable-llvm-timestamps.patch -- Disable LLVM timestamps
Patch1:         julia-disable-llvm-timestamps.patch

BuildRequires:  arpack-ng-devel
BuildRequires:  blas-devel
BuildRequires:  dSFMT-devel
BuildRequires:  double-conversion-devel
BuildRequires:  fdupes
BuildRequires:  fftw3-threads-devel
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  gmp-devel
# fix directory owner
BuildRequires:  hicolor-icon-theme
BuildRequires:  lapack-devel
BuildRequires:  libunwind-devel
BuildRequires:  llvm-clang >= 3.3
BuildRequires:  llvm-devel
BuildRequires:  m4
BuildRequires:  mpfr-devel
BuildRequires:  ncurses-devel
BuildRequires:  openlibm-devel
BuildRequires:  openspecfun-devel
BuildRequires:  patchelf
BuildRequires:  pcre-devel >= 8.31
BuildRequires:  perl
BuildRequires:  readline-devel
BuildRequires:  suitesparse-devel
BuildRequires:  update-desktop-files
BuildRequires:  utf8proc-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       ncurses
Requires:       readline
# Julia uses dlopen
Requires:       libarpack2
Requires:       libblas3
Requires:       libfftw3_threads3
Requires:       liblapack3
Recommends:     git
# Julia uses unversioned .so files
# https://github.com/JuliaLang/julia/issues/6742
Recommends:     gmp-devel
Recommends:     mpfr-devel
Recommends:     openlibm-devel
Recommends:     openspecfun-devel
Recommends:     pcre-devel
Recommends:     suitesparse-devel
Recommends:     arpack-ng-devel

%description
Julia is a high-level, high-performance dynamic programming language for
technical computing, with syntax that is familiar to users of other technical
computing environments. It provides a sophisticated compiler, distributed
parallel execution, numerical accuracy, and an extensive mathematical function
library. The library, largely written in Julia itself, also integrates mature,
best-of-breed C and Fortran libraries for linear algebra, random number
generation, signal processing, and string processing.

%package        devel
Summary:        Julia development, debugging and testing files
Group:          Development/Languages/Other
Requires:       %{name} = %{version}

%description    devel
Contains library symbolic links and header files for developing applications
linking to the Julia library, in particular embedding it, as well as tests and a
debugging version of Julia. This package is normally not needed when programming
in the Julia language, but rather for embedding Julia into external programs or
debugging Julia itself.

%package        doc
Summary:        Julia documentation and code examples
Group:          Documentation/Other
BuildArch:      noarch

%description    doc
Contains the Julia manual, the reference documentation of the standard library.

%package        examples
Summary:        Julia code examples
Group:          Documentation/Other
BuildArch:      noarch

%description    examples
Contains the Julia code examples.

%{expand:%global juliabuildopts %(cat %{SOURCE1})}

%prep
%setup -q -n julia-%{version}
%patch1 -p1

# remove .gitignore
find . -name ".git*" -exec rm {} \;

cd deps
tar xzf %{SOURCE10}
tar xzf %{SOURCE11}

mv -T Rmath-%{rmath_ver} Rmath
mv -T libuv-%{libuv_ver} libuv

cp %{SOURCE12} ./

%build

%ifarch x86_64
%define julia_march core2
%else
%define julia_march pentium4
%endif

make %{?_smp_mflags} MARCH=%{julia_march} \
                     prefix=%{_prefix} \
                     libdir=%{_libdir} \
                     sysconfdir=%{_sysconfdir} \
                     %{juliabuildopts}

%install
make install DESTDIR=%{buildroot} \
             MARCH=%{julia_march} \
             prefix=%{_prefix} \
             libdir=%{_libdir} \
             sysconfdir=%{_sysconfdir} \
             %{juliabuildopts}

# GZip man page.
gzip %{buildroot}/%{_mandir}/man1/julia.1

# Copy the man page for every executable.
cd %{buildroot}/%{_mandir}/man1/
ln -sf julia.1.gz julia-debug.1.gz

# Symbolic link of the library libjulia.so for the julia-devel package.
cd %{buildroot}/%{_libdir}
ln -s julia/libjulia.so libjulia.so

rm -f %{buildroot}%{_libdir}/julia/libuv.a
rm -f %{buildroot}%{_datadir}/julia/base/build.h
rm -f %{buildroot}%{_datadir}/julia/base/Makefile

%suse_update_desktop_file -r julia "Science;Math"

%check
# cd test && make all

%post devel -p /sbin/ldconfig

%postun devel -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc CONTRIBUTING.md LICENSE.md NEWS.md README.md
%{_bindir}/julia
%{_libdir}/julia/
%dir %{_datadir}/julia
%{_datadir}/julia/base
%{_datadir}/julia/helpdb.jl
%{_mandir}/man1/julia.1.*
%dir %{_sysconfdir}/julia/
%config(noreplace) %{_sysconfdir}/julia/juliarc.jl
# Exclude development files.
%exclude %{_libdir}/julia/libjulia-debug.so
%{_datadir}/appdata/julia.appdata.xml
%dir %{_datadir}/appdata/
%{_datadir}/applications/julia.desktop
%{_datadir}/icons/hicolor/scalable/apps/julia.svg

%files devel
%defattr(-,root,root)
%{_bindir}/julia-debug
%{_datadir}/julia/test/
%{_datadir}/julia/build_sysimg.jl
%{_includedir}/julia/
%{_libdir}/libjulia.so
%{_libdir}/julia/libjulia-debug.so
%{_mandir}/man1/julia-debug.1.*

%files doc
%defattr(-,root,root)
%docdir %{_datadir}/julia/doc
%{_datadir}/julia/doc
%exclude %{_datadir}/julia/doc/Makefile
%exclude %{_datadir}/julia/doc/README.md

%files examples
%defattr(-,root,root)
%{_datadir}/julia/examples

%changelog
openSUSE Build Service is sponsored by