File scala.spec of Package scala

#  
# spec file for package scala (Version 2.12.x)
#  
# Copyright (c) 2012 lumnis@gmail.com
#
# 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/
#
# See also
# http://www.scala-lang.org/contribute/hacker-guide.html
# https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/scala

Name:           scala
Summary:        Scala Compiler and Tools
Version:        2.12.8
Release:        0 
License:        FreeBsd Type
Group:          Development/Libraries/Java
Source:         https://github.com/scala/scala/archive/%{name}-%{version}.tgz
Source1:        http://scala-lang.org/files/archive/%{name}-docs-%{version}.txz
Source2:        https://github.com/scala/scala/archive/%{name}-sources-%{version}.tar.gz
#Source2:        http://scala-lang.org/files/archive/%{name}--%{version}.tgz
URL:            http://www.scala-lang.org
Patch0:         run-scala-unix.patch
Patch1:         run-scalac-unix.patch
Patch2:         run-scaladoc-unix.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  unzip, xz
BuildRequires:  git 
BuildRequires:  java-devel >= 1.8.0
BuildRequires:  update-alternatives
BuildRequires:  ant ant-apache-regexp ant-contrib ant-nodeps
#BuildRequires:  aqute-bnd
#BuildRequires:  junit4
#BuildRequires:  curl
#BuildRequires:  felix-framework
#BuildRequires:  pax-logging
Requires:       java >= 1.8.0
#Requires:       jline2
BuildArch:      noarch


%description
Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages. It is also fully interoperable with Java.


%package docs
Summary:        Scala Documentation
License:        FreeBsd Type
Requires:       scala
Group:          Development/Libraries/Java

%description docs
This package provides documentation to the scala programming language.



%package examples
Summary:        Scala programming examples
License:        FreeBsd Type
Requires:       scala
Group:          Development/Libraries/Java

%description examples
This will install some scala examples.



%prep
%setup -q -n "%{name}-%{version}"
#%setup -q -n "%{name}-%{version}-devel-docs"
cd bin
%patch0
%patch1
%patch2

# remove the third party jars
#find . -iname '*.jar' | xargs rm -rf

%build
# building structions from source -inactive- 
# set java heap size for build with ant
#export ANT_OPTS="-Xms1024m -Xmx1024m"
#export ANT_OPTS="-Xmx2612M -Xss2M -server -XX:MaxPermSize=180M"
#export ANT_OPTS="-Xms2500M -Xmx2500M -Xss8M -XX:MaxPermSize=1024M -XX:+UseParallelGC"
#%ant build
#%ant dist
#%ant clean build-opt 
#%ant -Dant.jar=%{_javadir}/ant.jar build
#%ant build-opt pac.doc osgi.done -Dbuild.release=true

%install
# lib
%__install -d -m 0755 "%{buildroot}%{_datadir}/%{name}"
%__cp -rp lib "%{buildroot}%{_datadir}/%{name}/"

# docs
%__cp -rp doc "%{buildroot}%{_datadir}/%{name}/"

# examples
#%__cp -rp lib "%{buildroot}%{_datadir}/%{name}/"

# startscript
%__install -d -m 0755 "%{buildroot}%{_bindir}"
%__install -m 0755 bin/scalac  "%{buildroot}%{_bindir}"
%__install -m 0755 bin/fsc  "%{buildroot}%{_bindir}"
%__install -m 0755 bin/scala  "%{buildroot}%{_bindir}"
%__install -m 0755 bin/scaladoc  "%{buildroot}%{_bindir}"

########################################  
# environment scripts
########################################

# set Environment Variable for bash
cat > %{name}.sh << EOF
# add Scala Environment Path for Library access 

export SCALA_HOME=%{_datadir}/%{name}

EOF

# set Environment Variable for csh
cat > %{name}.csh << EOF
# add Scala Environment Path for Library access 

setenv SCALA_HOME %{_datadir}/%{name}

EOF

# install scripts for bash and csh
install -d -m 755 %{buildroot}/etc  
install -d -m 755 %{buildroot}/etc/profile.d  
install -m 644 %{name}.sh %{name}.csh %{buildroot}/etc/profile.d

%clean
%{__rm} -rf %{buildroot}

%post  
/sbin/ldconfig  
   
%postun  
/sbin/ldconfig

%files
%defattr(-, root, root)
#%doc README
%{_bindir}/scala
%{_bindir}/scalac
%{_bindir}/fsc
%{_bindir}/scaladoc
%{_datadir}/%{name}
%{_datadir}/%{name}/lib
%{_datadir}/%{name}/lib/*.jar
%config /etc/profile.d/%{name}.*
%exclude %{_datadir}/%{name}/docs/development/*
%exclude %{_datadir}/%{name}/docs/examples/*

%files docs
%defattr(-, root, root)
#%doc docs/README
#%{_datadir}/%{name}/docs/development/*


%files examples
%defattr(-, root, root)
#%{_datadir}/%{name}/docs/examples/*


%changelog
openSUSE Build Service is sponsored by