File julia.spec of Package julia

#
# spec file for package julia
#
# Copyright (c) 2016 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/
#


%define rmath_ver 0.1
%define libuv_ver efb40768b7c7bd9f173a7868f74b92b1c5a61a0e
%define utf8proc_ver 85789180158ac7fff85b9f008828d6ac44f072ea
%define llvm_ver 3.3
%define compat_mode 0
%define src_name julia-tarball
Version:        0.4.6
Release:        0
Url:            http://julialang.org/
Source0:        https://github.com/JuliaLang/julia/releases/download/v%{version}/julia-%{version}.tar.gz
# external sources
Source10:       https://api.github.com/repos/JuliaLang/libuv/tarball/%{libuv_ver}#/libuv-%{libuv_ver}.tar.gz
Source11:       https://api.github.com/repos/JuliaLang/Rmath-julia/tarball/v%{rmath_ver}#/Rmath-julia-%{rmath_ver}.tar.gz
Source12:       https://api.github.com/repos/JuliaLang/utf8proc/tarball/%{utf8proc_ver}#/utf8proc-%{utf8proc_ver}.tar.gz
# LLVM 3.3 will be bundle until upstream change the supported LLVM version. As
# it can be seen in upstream issues #9336 and #13209, there are still many
# problems related with LLVM 3.5, regarding both the build process and the JIT
# compiler used by Julia. Thus, it is better for now stick with LLVM 3.3. For
# more information, see:
#     https://github.com/JuliaLang/julia/issues/13208
#     https://github.com/JuliaLang/julia/issues/9336
Source13:       http://llvm.org/releases/%{llvm_ver}/llvm-%{llvm_ver}.src.tar.gz
Source99:       juliabuildopts
# 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
BuildRequires:  hicolor-icon-theme
BuildRequires:  lapack-devel
BuildRequires:  libgit2-devel
BuildRequires:  libunwind-devel
BuildRequires:  m4
BuildRequires:  mpfr-devel
BuildRequires:  ncurses-devel
BuildRequires:  openlibm-devel
BuildRequires:  openspecfun-devel
BuildRequires:  patchelf
BuildRequires:  pcre2-devel
BuildRequires:  perl
BuildRequires:  python >= 2.5
BuildRequires:  readline-devel
BuildRequires:  suitesparse-devel
BuildRequires:  update-desktop-files
BuildRequires:  zlib-devel
Requires:       libarpack2
Requires:       libblas3
Requires:       libfftw3_threads3
Requires:       liblapack3
Requires:       libpcre2-8-0
Requires:       ncurses
Requires:       readline
Recommends:     arpack-ng-devel
Recommends:     git
Recommends:     gmp-devel
Recommends:     mpfr-devel
Recommends:     openlibm-devel
Recommends:     openspecfun-devel
Recommends:     pcre2-devel
Recommends:     suitesparse-devel
%if 0%{?compat_mode} == 0
Name:           julia
%else
Name:           julia-compat
%endif
%if 0%{?compat_mode} == 0
Summary:        High-level, high-performance dynamic programming language
License:        MIT and GPL-2.0+
Group:          Development/Languages/Other
%else
Summary:        High-level, high-performance dynamic programming language (without CPU optimizations)
License:        MIT and GPL-2.0+
Group:          Development/Languages/Other
%endif
%if 0%{?compat_mode}
Conflicts:      otherproviders(julia)
Provides:       julia = %{version}
%endif
# Since the 32-bit julia package is already being built using MARCH=pentium4,
# which is the most generic flag supported, then the julia-compat mode only
# makes sense for 64-bit architectures.
%if 0%{?compat_mode}
ExclusiveArch:  x86_64
%endif

%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}
%if 0%{?compat_mode}
Conflicts:      otherproviders(julia-devel)
%endif

%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.

%if 0%{?compat_mode} == 0
%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.
%endif

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

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

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

pushd deps/
cp %{SOURCE10} ./
cp %{SOURCE11} ./
cp %{SOURCE12} ./
cp %{SOURCE13} ./
popd

%build

%if 0%{?compat_mode} == 0
    %ifarch x86_64

        %define julia_march core2
    %endif

    %ifarch %ix86

        %define julia_march pentium4
    %endif
%else
    # compat_mode is only defined for 64-bit architecture.

    %define julia_march x86-64
%endif

%define julia_builddir %{_builddir}/%{name}/
make %{?_smp_mflags} MARCH=%{julia_march} \
                     prefix=%{_prefix} \
                     bindir=%{_bindir} \
                     libdir=%{_libdir} \
                     libexecdir=%{_libexecdir} \
                     datarootdir=%{_datarootdir} \
                     includedir=%{_includedir} \
                     sysconfdir=%{_sysconfdir} \
                     %{juliabuildopts} \
                     release
make %{?_smp_mflags} MARCH=%{julia_march} \
                     prefix=%{_prefix} \
                     bindir=%{_bindir} \
                     libdir=%{_libdir} \
                     libexecdir=%{_libexecdir} \
                     datarootdir=%{_datarootdir} \
                     includedir=%{_includedir} \
                     sysconfdir=%{_sysconfdir} \
                     %{juliabuildopts} \
                     debug

%check
# The tests will only pass if openblas is being used.
# make test

%install
make install DESTDIR=%{buildroot} \
             MARCH=%{julia_march} \
             prefix=%{_prefix} \
             bindir=%{_bindir} \
             libdir=%{_libdir} \
             libexecdir=%{_libexecdir} \
             datarootdir=%{_datarootdir} \
             includedir=%{_includedir} \
             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

# Fix documentation directories.
mkdir -p %{buildroot}%{_docdir}/julia
mv -f %{buildroot}%{_datadir}/doc/julia/* %{buildroot}%{_docdir}/julia/
rm -r %{buildroot}%{_datadir}/doc/julia

%if 0%{?compat_mode}
rm -rf %{buildroot}%{_docdir}/julia/

# The 'application' object must be only provided by one package
# Alternatively, we could rename the .appdata and .desktop file to have
# both applications show up in a valid way, but that would require the
# -compat appdata to be modified to make the difference clear
rm %{buildroot}%{_datadir}/appdata/julia.appdata.xml
%endif

%suse_update_desktop_file -r julia Science Math

%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
%dir %{_datadir}/julia
%{_datadir}/julia/base
%{_datadir}/julia/site
%if !%{?compat_mode}
%dir %{_datadir}/appdata/
%{_datadir}/appdata/julia.appdata.xml
%endif
%{_datadir}/applications/julia.desktop
%{_datadir}/icons/hicolor/scalable/apps/julia.svg
%{_libdir}/julia/
%{_mandir}/man1/julia.1.*
%dir %{_sysconfdir}/julia/
%config(noreplace) %{_sysconfdir}/julia/juliarc.jl
# Exclude development files.
%exclude %{_libdir}/julia/libccalltest.so
%exclude %{_libdir}/julia/libjulia-debug.so
%exclude %{_libdir}/julia/sys-debug.so
# Exclude examples and documentation.
%exclude %{_docdir}/julia/html
%exclude %{_docdir}/julia/examples

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

%if 0%{?compat_mode} == 0
%files doc
%defattr(-,root,root)
%{_docdir}/julia
%exclude %{_docdir}/julia/examples
%exclude %{_docdir}/julia/CONTRIBUTING.md
%exclude %{_docdir}/julia/LICENSE.md
%exclude %{_docdir}/julia/NEWS.md
%exclude %{_docdir}/julia/README.md

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

%changelog
openSUSE Build Service is sponsored by