Blob Blame History Raw
%global scl devtoolset-3
%scl_package %scl

Summary: Package that installs %scl
Name: %scl_name
Version: 3.0
Release: 15%{?dist}
BuildArch: noarch
License: GPLv2+
Group: Applications/File
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# The base package must require everything in the collection
Requires: %{scl_prefix}toolchain %{scl_prefix}ide %{scl_prefix}perftools

BuildRequires: scl-utils-build >= 20120927-11
BuildRequires: iso-codes

%description
This is the main package for %scl Software Collection.

%package runtime
Summary: Package that handles %scl Software Collection.
Group: Applications/File
Requires: scl-utils >= 20120927-11
Requires(post): libselinux policycoreutils-python
Requires(postun): libselinux policycoreutils-python
Requires(preun): libselinux policycoreutils-python

%description runtime
Package shipping essential scripts to work with %scl Software Collection.

%package build
Summary: Package shipping basic build configuration
Group: Applications/File
Requires: %{scl_prefix}runtime
Requires: scl-utils-build >= 20120927-11

%description build
Package shipping essential configuration macros to build %scl Software Collection.

%package toolchain
Summary: Package shipping basic toolchain applications
Group: Applications/File
Requires: %{scl_prefix}runtime
Requires: %{scl_prefix}gcc %{scl_prefix}gcc-c++ %{scl_prefix}gcc-gfortran
Requires: %{scl_prefix}binutils %{scl_prefix}gdb %{scl_prefix}strace
Requires: %{scl_prefix}dwz %{scl_prefix}elfutils %{scl_prefix}memstomp
Requires: %{scl_prefix}ltrace

%description toolchain
Package shipping basic toolchain applications (compiler, debugger, ...)

%package ide
Summary: Package shipping Eclipse IDE
Group: Applications/File
Requires: %{scl_prefix}runtime
Requires: %{scl_prefix}eclipse-cdt
Requires: %{scl_prefix}eclipse-cdt-parsers
Requires: %{scl_prefix}eclipse-cdt-sdk
Requires: %{scl_prefix}eclipse-changelog
Requires: %{scl_prefix}eclipse-egit
Requires: %{scl_prefix}eclipse-emf
Requires: %{scl_prefix}eclipse-emf-core
Requires: %{scl_prefix}eclipse-emf-examples
Requires: %{scl_prefix}eclipse-emf-sdk
Requires: %{scl_prefix}eclipse-equinox-osgi
Requires: %{scl_prefix}eclipse-gcov
Requires: %{scl_prefix}eclipse-gef
Requires: %{scl_prefix}eclipse-gef-examples
Requires: %{scl_prefix}eclipse-gef-sdk
Requires: %{scl_prefix}eclipse-gprof
Requires: %{scl_prefix}eclipse-jdt
Requires: %{scl_prefix}eclipse-jgit
Requires: %{scl_prefix}eclipse-linuxtools
Requires: %{scl_prefix}eclipse-manpage
Requires: %{scl_prefix}eclipse-oprofile
Requires: %{scl_prefix}eclipse-pde
Requires: %{scl_prefix}eclipse-perf
Requires: %{scl_prefix}eclipse-platform
Requires: %{scl_prefix}eclipse-rcp
Requires: %{scl_prefix}eclipse-rpm-editor
Requires: %{scl_prefix}eclipse-rse
Requires: %{scl_prefix}eclipse-rse-server
Requires: %{scl_prefix}eclipse-swt
Requires: %{scl_prefix}eclipse-systemtap
Requires: %{scl_prefix}eclipse-valgrind
Requires: %{scl_prefix}eclipse-mylyn
Requires: %{scl_prefix}eclipse-mylyn-builds
Requires: %{scl_prefix}eclipse-mylyn-builds-hudson
Requires: %{scl_prefix}eclipse-mylyn-context-cdt
Requires: %{scl_prefix}eclipse-mylyn-context-java
Requires: %{scl_prefix}eclipse-mylyn-context-pde
Requires: %{scl_prefix}eclipse-mylyn-context-team
Requires: %{scl_prefix}eclipse-mylyn-docs-epub
Requires: %{scl_prefix}eclipse-mylyn-docs-htmltext
Requires: %{scl_prefix}eclipse-mylyn-docs-wikitext
Requires: %{scl_prefix}eclipse-mylyn-ide
Requires: %{scl_prefix}eclipse-mylyn-sdk
Requires: %{scl_prefix}eclipse-mylyn-tasks-bugzilla
Requires: %{scl_prefix}eclipse-mylyn-tasks-trac
Requires: %{scl_prefix}eclipse-mylyn-tasks-web
Requires: %{scl_prefix}eclipse-mylyn-versions
Requires: %{scl_prefix}eclipse-mylyn-versions-cvs
Requires: %{scl_prefix}eclipse-mylyn-versions-git

%description ide
Package shipping Eclipse IDE

%package perftools
Summary: Package shipping performance tools
Group: Applications/File
Requires: %{scl_prefix}runtime
Requires: %{scl_prefix}oprofile %{scl_prefix}systemtap %{scl_prefix}valgrind
Requires: %{scl_prefix}dyninst

%description perftools
Package shipping performance tools (systemtap, oprofile)

%prep
%setup -c -T

%build
# Enable collection script
# ========================
cat <<EOF >enable
# General environment variables
export PATH=%{_bindir}\${PATH:+:\${PATH}}
export MANPATH=%{_mandir}:\${MANPATH}
export INFOPATH=%{_infodir}\${INFOPATH:+:\${INFOPATH}}

# Needed by Java Packages Tools to locate java.conf
export JAVACONFDIRS="%{_sysconfdir}/java:\${JAVACONFDIRS:-/etc/java}"

# Required by XMvn to locate its configuration files
export XDG_CONFIG_DIRS="%{_sysconfdir}/xdg:\${XDG_CONFIG_DIRS:-/etc/xdg}"
export XDG_DATA_DIRS="%{_datadir}:\${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"

export PCP_DIR=%{_scl_root}
# Some perl Ext::MakeMaker versions install things under /usr/lib/perl5
# even though the system otherwise would go to /usr/lib64/perl5.
export PERL5LIB=%{_scl_root}/%{perl_vendorarch}:%{_scl_root}/usr/lib/perl5:%{_scl_root}/%{perl_vendorlib}\${PERL5LIB:+:\${PERL5LIB}}
# bz847911 workaround:
# we need to evaluate rpm's installed run-time % { _libdir }, not rpmbuild time
# or else /etc/ld.so.conf.d files?
rpmlibdir=\$(rpm --eval "%%{_libdir}")
# bz1017604: On 64-bit hosts, we should include also the 32-bit library path.
if [ "\$rpmlibdir" != "\${rpmlibdir/lib64/}" ]; then
  rpmlibdir32=":%{_scl_root}\${rpmlibdir/lib64/lib}"
fi
export LD_LIBRARY_PATH=%{_scl_root}\$rpmlibdir\$rpmlibdir32\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
# duplicate python site.py logic for sitepackages
pythonvers=`python -c 'import sys; print sys.version[:3]'`
export PYTHONPATH=%{_prefix}/lib64/python\$pythonvers/site-packages:%{_prefix}/lib/python\$pythonvers/site-packages\${PYTHONPATH:+:\${PYTHONPATH}}
EOF

# Sudo script
# ===========
cat <<EOF >sudo
#! /bin/sh
# TODO: parse & pass-through sudo options from \$@
sudo_options="-E"

for arg in "\$@"
do
   case "\$arg" in
    *\'*)
      arg=`echo "\$arg" | sed "s/'/'\\\\\\\\''/g"` ;;
   esac
   cmd_options="\$cmd_options '\$arg'" 
done
exec /usr/bin/sudo \$sudo_options LD_LIBRARY_PATH=\$LD_LIBRARY_PATH PATH=\$PATH scl enable %{scl} "\$cmd_options"
EOF

# Java configuration
# ==================
cat <<EOF >java.conf
JAVA_LIBDIR=%{_javadir}
JNI_LIBDIR=%{_jnidir}
JVM_ROOT=%{_jvmdir}
EOF

# Ivy configuration
# =================
cat <<EOF >ivysettings.xml
<!-- Ivy configuration file for %{scl} software collection
     Artifact resolution order is:
      1. %{scl} collection
      2. base operating system
-->
<ivysettings>
  <settings defaultResolver="default"/>
  <resolvers>
    <filesystem name="%{scl}-public">
      <ivy pattern="\${ivy.conf.dir}/lib/[module]/apache-ivy-[revision].xml" />
      <artifact pattern="%{_datadir}/java/\[artifact].[ext]" />
    </filesystem>
    <filesystem name="public">
      <ivy pattern="\${ivy.conf.dir}/lib/[module]/apache-ivy-[revision].xml" />
      <artifact pattern="%{_root_datadir}/java/\[artifact].[ext]" />
    </filesystem>
    <chain name="main" dual="true">
      <resolver ref="%{scl}-public"/>
      <resolver ref="public"/>
    </chain>
  </resolvers>
  <include url="\${ivy.default.settings.dir}/ivysettings-local.xml"/>
  <include url="\${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
</ivysettings>
EOF

# XMvn configuration
# =================
cat <<EOF >configuration.xml
<!-- XMvn configuration file for %{scl} software collection
     Artifact resolution order is:
      1. %{scl} collection
      2. base operating system
-->
<configuration>
  <resolverSettings>
    <prefixes>
      <prefix>/opt/rh/%{scl}/root</prefix>
    </prefixes>
  </resolverSettings>
  <installerSettings>
    <metadataDir>opt/rh/%{scl}/root/usr/share/maven-fragments</metadataDir>
  </installerSettings>
  <repositories>
    <repository>
      <id>%{scl}-resolve</id>
      <type>compound</type>
      <properties>
        <prefix>opt/rh/%{scl}/root</prefix>
        <namespace>%{scl}</namespace>
      </properties>
      <configuration>
        <repositories>
          <repository>base-resolve</repository>
        </repositories>
      </configuration>
    </repository>
    <repository>
      <id>resolve-system</id>
      <type>compound</type>
      <properties>
        <prefix>/</prefix>
      </properties>
      <configuration>
        <repositories>
          <repository>%{scl}-resolve</repository>
          <repository>base-resolve</repository>
        </repositories>
      </configuration>
    </repository>
    <repository>
      <id>install</id>
      <type>compound</type>
      <properties>
        <prefix>opt/rh/%{scl}/root</prefix>
        <namespace>%{scl}</namespace>
      </properties>
      <configuration>
        <repositories>
          <repository>base-install</repository>
        </repositories>
      </configuration>
    </repository>
    <repository>
      <id>install-raw-pom</id>
      <type>compound</type>
      <properties>
        <prefix>opt/rh/%{scl}/root</prefix>
        <namespace>%{scl}</namespace>
      </properties>
      <configuration>
        <repositories>
          <repository>base-raw-pom</repository>
        </repositories>
      </configuration>
    </repository>
    <repository>
      <id>install-effective-pom</id>
      <type>compound</type>
      <properties>
        <prefix>opt/rh/%{scl}/root</prefix>
        <namespace>%{scl}</namespace>
      </properties>
      <configuration>
        <repositories>
          <repository>base-effective-pom</repository>
        </repositories>
      </configuration>
    </repository>
  </repositories>
</configuration>
EOF

%install
(%{scl_install})

mkdir -p %{buildroot}%{_scl_root}/etc/alternatives %{buildroot}%{_scl_root}/var/lib/alternatives

install -d -m 755 %{buildroot}%{_scl_scripts}
install -p -m 755 enable %{buildroot}%{_scl_scripts}/

install -d -m 755 %{buildroot}%{_scl_scripts}
install -p -m 755 sudo %{buildroot}%{_bindir}/

install -d -m 755 %{buildroot}%{_sysconfdir}/java
install -p -m 644 java.conf %{buildroot}%{_sysconfdir}/java/

install -d -m 755 %{buildroot}%{_sysconfdir}/ivy
install -p -m 644 ivysettings.xml %{buildroot}%{_sysconfdir}/ivy/

install -d -m 755 %{buildroot}%{_sysconfdir}/xdg/xmvn
install -p -m 644 configuration.xml %{buildroot}%{_sysconfdir}/xdg/xmvn/

%files

%files runtime
%scl_files
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_sysconfdir}/selinux-equiv.created
%{_sysconfdir}/ivy
%{_sysconfdir}/java
%{_sysconfdir}/xdg/xmvn
%dir %{_scl_root}/etc/alternatives

%files build
%{_root_sysconfdir}/rpm/macros.%{scl}*

%files toolchain

%files ide

%files perftools

%post runtime
if [ ! -f %{_sysconfdir}/selinux-equiv.created ]; then
  /usr/sbin/semanage fcontext -a -e / %{_scl_root}
  restorecon -R %{_scl_root}
  touch %{_sysconfdir}/selinux-equiv.created
fi

%preun runtime
[ $1 = 0 ] && rm -f %{_sysconfdir}/selinux-equiv.created || :

%postun runtime
if [ $1 = 0 ]; then
  /usr/sbin/semanage fcontext -d %{_scl_root}
  [ -d %{_scl_root} ] && restorecon -R %{_scl_root} || :
fi

%changelog
* Wed Jun 04 2014 Marek Polacek <polacek@redhat.com> 3.0-15
- Drop the -vc subpackage (#1104342)

* Tue Jun 03 2014 Mat Booth <mat.booth@redhat.com> - 3.0-14
- Prevent premature command substitution (#1102796)

* Tue Jun 03 2014 Marek Polacek <polacek@redhat.com> 3.0-13
- Create alternatives directories (#1101246)

* Tue Jun 03 2014 Mat Booth <mat.booth@redhat.com> - 3.0-12
- Fix MANPATH variable (#1102741)

* Fri May 30 2014 Alexander Kurtakov <akurtako@redhat.com> 3.0-11
- Re enable mylyn-docs-epub.

* Tue May 27 2014 Alexander Kurtakov <akurtako@redhat.com> 3.0-10
- Comment mylyn-epub as the new version has huge dependency chain.

* Tue May 27 2014 Alexander Kurtakov <akurtako@redhat.com> 3.0-9
- Drop eclipse-xsd as it's no longer part of emf.
- Drop eclipse-rpmstubby as it's merged into rpm-editor.

* Wed May 21 2014 Mat Booth <mat.booth@redhat.com> - 3.0-8
- Revert ant_home fix temporarily

* Mon May 19 2014 Marek Polacek <polacek@redhat.com> 3.0-7
- Require ltrace (#1098247, #1098249)
- Properly set ANT_HOME (#1087654)

* Fri May 16 2014 Mat Booth <mat.booth@redhat.com> - 3.0-6
- Drop maven30 collection bits (we can use base OS maven on rhel7)

* Fri May 16 2014 Mat Booth <mat.booth@redhat.com> - 3.0-5
- Require newest version of scl-utils

* Fri May 16 2014 Mat Booth <mat.booth@redhat.com> - 3.0-4
- Conditionally enable maven30 collection
- Add maven scl macros for other packages to use

* Thu May 15 2014 Mat Booth <mat.booth@redhat.com> - 3.0-3
- Add collection-specific maven, java, ivy configuration

* Thu May 15 2014 Alexander Kurtakov <akurtako@redhat.com> 3.0-2
- Build subpackage should R: scl-utils.

* Tue Mar 4 2014 Marek Polacek <polacek@redhat.com> 3.0-1
- Initial package