# # Since lsof requires a separate build on 64-bit kernel systems than # on 32-bit kernel systems, and since this spec file builds an rpm image # on one system at a time only, this spec includes a "Source1" that is # nothing more than this same code built on a 64-bit kernel system. # If you then use this spec file on a 32-bit kernel system, it will build # the 32-bit version and simply copy the prebuilt 64-bit version, such # that you get an RPM that includes both. # "lsof" is the default 32-bit version. # "lsof64" is the 64-bit version. # Summary: A utility which lists open files on a Linux/UNIX system. Name: lsof Version: 4.89 Release: 1 License: BSD Group: Development/Debuggers Source0: ftp://ftp.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_%{version}.tar.gz # Source1 is a binary file -- the lsof command built on a 64-bit kernel. #Source1: lsof64_%{_target_os} #Source2: IBM_ILA Patch0: lsof-%{version}-check64kern.patch Prefix: %{_prefix} Buildroot: /var/tmp/%{name}-root #Build version for each specific AIX OS level # We don't see any specific reason to build it has an of Specific. # So removing the os check part as of now. %define DEFCC cc %description Lsof stands for LiSt Open Files, and it does just that: it lists information about files that are open by the processes running on a UNIX system. NOTE: if 'lsof' does not work for you, and you are on a 64-bit system, check the package for an 'lsof64' command. It represents the same 'lsof' command, but built on a 64-bit system. (The 'lsof' command should determine this for you and execute the 'lsof64' command if appropriate for your system). Of course, it is generally recommened that lsof be built locally from source on the same system on which it is to run. %prep %setup -q -n lsof_%{version} [ -f lsof_%{version}_src.tar ] && tar xf lsof_%{version}_src.tar [ -d lsof_%{version}_src.linux -a ! -d lsof_%{version_src} ] && \ mv lsof_%{version}_src.linux lsof_%{version}_src [ -d lsof_%{version}_src ] && cd lsof_%{version}_src %ifos aix5.0 aix5.1 aix5.2 aix5.3 %patch0 -p0 -b .check64kern %endif # Put License into place #cat $RPM_SOURCE_DIR/IBM_ILA > LICENSE echo "See file 00DIST for more information." >> LICENSE %build # Use the default compiler for this platform - gcc otherwise if [[ -z "$CC" ]] then if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then export CC=%{DEFCC} export bld_target=aix else export CC=gcc export bld_target=aixgcc fi fi if test "X$CC" != "Xgcc" then export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's:-fsigned-char::'` export CFLAGS="$RPM_OPT_FLAGS" fi rm -rf $RPM_BUILD_ROOT [ -d lsof_%{version}_src ] && cd lsof_%{version}_src ./Configure -n $bld_target #### REMOVE THE "-DCHECK_KERN64" if you are building on a system #### with a 64-bit kernel running!!!!! #### (the resulting binary would otherwise be useless). %ifos aix6.1 aix7.1 make CDEF="-DHASXOPT_ROOT" %endif %ifos aix5.0 aix5.1 aix5.2 aix5.3 make CDEF="-DHASXOPT_ROOT -DCHECK_KERN64" %endif %ifos aix4.3 make CDEF="-DHASXOPT_ROOT" %endif %install rm -rf $RPM_BUILD_ROOT [ -d lsof_%{version}_src ] && cd lsof_%{version}_src install -d ${RPM_BUILD_ROOT}%{prefix}/sbin install -d ${RPM_BUILD_ROOT}%{prefix}/man/man8 install lsof ${RPM_BUILD_ROOT}%{prefix}/sbin install lsof.8 ${RPM_BUILD_ROOT}%{prefix}/man/man8/ # On 5.1, take the 'lsof64' binary (which is 'lsof' built on a # 5.1 64-bit system) and copy it into place; it can be run by users # who install this package on a 64-bit system. 'lsof64' is built # using this exact same source package on a 64-bit system and copying # the resulting 'lsof' executable into the sources directory. %ifos aix5.0 aix5.1 aix5.2 aix5.3 cp %{SOURCE1} ./lsof64 install lsof64 ${RPM_BUILD_ROOT}%{prefix}/sbin %endif (cd $RPM_BUILD_ROOT mkdir -p usr/sbin cd usr/sbin ln -sf ../..%{prefix}/sbin/lsof . %ifos aix5.0 aix5.1 aix5.2 aix5.3 ln -sf ../..%{prefix}/sbin/lsof64 . %endif cd - mkdir -p usr/man/man8 cd usr/man/man8 ln -sf ../../..%{prefix}/man/man8/* . ) %clean rm -rf $RPM_BUILD_ROOT %files %defattr(644,root,system,755) %doc lsof_%{version}_src/00* lsof_%{version}_src/LICENSE %attr(2755,root,system) %{prefix}/sbin/lsof %{prefix}/man/man8/lsof.8* /usr/man/man8/lsof.8* /usr/sbin/lsof %ifos aix5.0 aix5.1 aix5.2 aix5.3 %attr(2755,root,system) %{prefix}/sbin/lsof64 /usr/sbin/lsof64 %endif %changelog * Tue Mar 07 2017 Sangamesh Mallayya 4.89-1 - Rebuild it to remove OS specific dependency. * Fri Mar 11 2016 Ayappan P - Update to Version 4.89 * Thu Feb 2 2006 Reza Arbab 4.61-3 - Adding seperate builds for AIX 5.2 and 5.3. * Tue Feb 11 2003 David Clissold - On AIX5, Make lsof check the kernel size at startup to ensure - we are running a 32-bit kernel; if not, exec the lsof64 - binary. That way, user can just run 'lsof' for either case. * Mon Sep 09 2002 David Clissold - For AIX 5, add lsof64 (build from the same source on a 5.1 - system with a 64-bit kernel). Added as a source. - Ideally, the source is built on the system where it will be run. - Adding the 64bit version as a source and then building the rpm - on a 32-bit system allows us to make one package with both versions. - Run "lsof" if on a 32-bit system, or "lsof64" if on a 64-bit system. * Wed May 29 2002 David Clissold - Update to Version 4.61 * Tue Aug 14 2001 David Clissold - Update to Version 4.57 * Wed May 23 2001 Marc Stephenson - Version 4.56 * Wed Mar 21 2001 Marc Stephenson - Rebuild against new shared objects - Use default compiler * Fri Oct 27 2000 pkgmgr - Modify for AIX Freeware distribution - Adapted from RedHat lsof-4.47-2 - Contributors: Christian Gafton - Jeff Johnson - Preston Brown - Maciej Lesniewski