%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) # define license macro for el6 build %{!?_licensedir:%global license %%doc} Name: modules-tcl Version: 1.923 Release: 1%{?dist} Summary: Native Tcl version of the Environment Modules system Group: System Environment/Base License: GPLv2+ URL: http://modules.sourceforge.net/ Source0: http://downloads.sourceforge.net/modules/%{name}-%{version}.tar.gz Patch0: modules-tcl-1.923-fix-uname-release-test.patch BuildArch: noarch BuildRequires: tcl BuildRequires: dejagnu BuildRequires: perl %if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} > 6) BuildRequires: perl-podlators %endif %if 0%{?rhel} && 0%{?rhel} <= 6 BuildRequires: net-tools %else BuildRequires: hostname %endif Requires: tcl Requires: sed %if 0%{?rhel} && 0%{?rhel} <= 6 Requires: procps Requires: man Requires: net-tools %else Requires: procps-ng Requires: man-db Requires: hostname %endif Requires(post): coreutils Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives Provides: environment(modules) %description The Environment Modules package is a tool that simplify shell initialization and lets users easily modify their environment during the session with modulefiles. Modules-Tcl is the full Tcl rewrite of the Modules package. Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command which interprets modulefiles. Typically modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system and users may have their own collection to supplement or replace the shared modulefiles. Modules can be loaded and unloaded dynamically and atomically, in an clean fashion. All popular shells are supported, including bash, ksh, zsh, sh, csh, tcsh, fish, as well as some scripting languages such as perl and python. Modules are useful in managing different versions of applications. Modules can also be bundled into metamodules that will load an entire suite of different applications. %prep %setup -q %patch0 -p1 -b .uname-release-test %build # configure script for this software is not generated by autoconf ./configure --prefix=%{_datadir}/%{name} \ --bindir=%{_bindir} \ --mandir=%{_mandir} \ --disable-doc-install \ --disable-example-modulefiles \ --with-modulepath=%{_sysconfdir}/modulefiles:%{_datadir}/modulefiles \ --with-cver-initdir=%{_datadir}/Modules/init make %{?_smp_mflags} %check make test %install make install DESTDIR=%{buildroot} # comply with other environment-modules packages modulefiles directory definition mkdir -p %{buildroot}%{_sysconfdir}/modulefiles mkdir -p %{buildroot}%{_datadir}/modulefiles mkdir -p %{buildroot}%{_sysconfdir}/profile.d %if 0%{?fedora} # setup for alternatives on Fedora touch %{buildroot}%{_sysconfdir}/profile.d/modules.{csh,sh} %else # install profile links to override environment-modules ln -s %{_datadir}/%{name}/init/profile.csh %{buildroot}%{_sysconfdir}/profile.d/t00_modules-tcl.csh ln -s %{_datadir}/%{name}/init/profile.sh %{buildroot}%{_sysconfdir}/profile.d/t00_modules-tcl.sh %endif # rename man pages to cohabit with other environment-modules packages mv %{buildroot}%{_mandir}/man1/module{,-tcl}.1 mv %{buildroot}%{_mandir}/man4/modulefile{,-tcl}.4 # install the rpm config file an environment-modules flavor should provide install -Dpm 644 contrib/rpm/macros.%{name} %{buildroot}/%{macrosdir}/macros.%{name} %if 0%{?fedora} %post # cleanup from pre-alternatives [ ! -L %{_sysconfdir}/profile.d/modules.sh ] && rm -f %{_sysconfdir}/profile.d/modules.sh [ ! -L %{_mandir}/man1/module.1.gz ] && rm -f %{_mandir}/man1/module.1.gz [ ! -L %{_mandir}/man4/modulefile.4.gz ] && rm -f %{_mandir}/man4/modulefile.4.gz %{_sbindir}/update-alternatives \ --install %{_sysconfdir}/profile.d/modules.sh modules.sh %{_datadir}/%{name}/init/profile.sh 10 \ --slave %{_sysconfdir}/profile.d/modules.csh modules.csh %{_datadir}/%{name}/init/profile.csh \ --slave %{_mandir}/man1/module.1.gz module.1.gz %{_mandir}/man1/module-tcl.1.gz \ --slave %{_mandir}/man4/modulefile.4.gz modulefile.4.gz %{_mandir}/man4/modulefile-tcl.4.gz %postun if [ $1 -eq 0 ] ; then %{_sbindir}/update-alternatives --remove modules.sh %{_datadir}/%{name}/init/profile.sh fi %endif %files %license COPYING.GPLv2 %doc ChangeLog NEWS README doc/diff_with_c-version.txt %{_sysconfdir}/modulefiles %if 0%{?fedora} %ghost %{_sysconfdir}/profile.d/modules.csh %ghost %{_sysconfdir}/profile.d/modules.sh %else %{_sysconfdir}/profile.d/t00_modules-tcl.csh %{_sysconfdir}/profile.d/t00_modules-tcl.sh %endif %{_bindir}/envml %dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/libexec %{_datadir}/%{name}/libexec/modulecmd.tcl %dir %{_datadir}/%{name}/init # follow same configuration approach than environment-modules %config(noreplace) %{_datadir}/%{name}/init/* %{_datadir}/modulefiles %if 0%{?fedora} %ghost %{_mandir}/man1/module.1.gz %ghost %{_mandir}/man4/modulefile.4.gz %endif %{_mandir}/man1/module-tcl.1.gz %{_mandir}/man4/modulefile-tcl.4.gz %{macrosdir}/macros.%{name} %changelog * Fri Jul 21 2017 Xavier Delaruelle - 1.923-1 - Update to 1.923 - Use --disable-example-modulefiles configure option to avoid example modulefiles installation - Add modules-tcl-1.923-fix-uname-release-test.patch to correct uname release test * Sat Apr 29 2017 Xavier Delaruelle - 1.832-1 - Update to 1.832 - Use --disable-doc-install configure option to handle doc instalation - Use rpm macro file provided in source tarball - Use alternatives for man pages as well * Tue Mar 7 2017 Xavier Delaruelle - 1.775-1 - Initial packaging.