# Tests by default. No tests: rpm -ba --define 'dotests 0' ncftp*.spec
%{!?dotests: %define dotests 1}
Summary: An improved FTP client.
Name: ncftp
Version: 3.2.6
Release: 2 
Prefix: %{_prefix}
License: ClArtistic  
URL: http://www.ncftp.com
Group: Applications/Internet
Source0: ftp://ftp.ncftp.com/ncftp/ncftp-%{version}-src.tar.gz

#%define DEFCC cc

%description
Ncftp is an improved FTP client.  Ncftp's improvements include support
for command line editing, command histories, recursive gets, automatic
anonymous logins and more.

Install ncftp if you use FTP to transfer files and you'd like to try
some of ncftp's additional features.

%prep
%setup -q

# Duplicate source for 32 & 64 bits
rm -rf   /tmp/%{name}-%{version}-32bit
cp -pr . /tmp/%{name}-%{version}-32bit
rm -fr *
mv       /tmp/%{name}-%{version}-32bit 32bit
cp -pr 32bit 64bit

%build
# Use the default compiler for this platform - gcc otherwise

export CC="/opt/freeware/bin/gcc"

if [[ -z "$CC" ]]
then
    if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then
       export CC=%{DEFCC}
    else 
       export CC=gcc
    fi
fi
if [[ "$CC" != "gcc" ]]
then
       export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's:-fsigned-char::'`
fi

# build on 64bit mode
cd 64bit
export OBJECT_MODE=64
export CFLAGS="$RPM_OPT_FLAGS -O2 -maix64"
export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"

%configure --enable-signals
make STRIPFLAG=""

if [ "%{dotests}" == 1 ]
then
    (gmake -k check || true)
fi


# build on 32bit mode
cd ../32bit
export OBJECT_MODE=32
export CFLAGS="$RPM_OPT_FLAGS -O2 -maix32 -D_LARGE_FILES"
export LDFLAGS="-L/opt/freeware/lib -Wl,-bmaxdata:0x80000000 -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib"

%configure --enable-signals
make STRIPFLAG=""

if [ "%{dotests}" == 1 ]
then
    (gmake -k check || true)
fi


%install
rm -rf $RPM_BUILD_ROOT
for dir in bin man/man1
do
   mkdir -p $RPM_BUILD_ROOT%{_prefix}/$dir
done

# install on 64bit mode
cd 64bit
export OBJECT_MODE=64
make prefix=$RPM_BUILD_ROOT%{_prefix} \
     mandir=$RPM_BUILD_ROOT%{_prefix}/man \
     BINDIR=$RPM_BUILD_ROOT%{_prefix}/bin \
     install
(
    cd  ${RPM_BUILD_ROOT}/%{prefix}/bin
    for fic in $(ls -1| grep -v -e _32 -e _64)
    do
	mv $fic "$fic"_64
    done
)
# install on 32bit mode
cd ../32bit
export OBJECT_MODE=32
make prefix=$RPM_BUILD_ROOT%{_prefix} \
     mandir=$RPM_BUILD_ROOT%{_prefix}/man \
     BINDIR=$RPM_BUILD_ROOT%{_prefix}/bin \
     install
(
    cd  ${RPM_BUILD_ROOT}/%{prefix}/bin
    for fic in $(ls -1| grep -v -e _32 -e _64)
    do
	mv $fic "$fic"_32
	ln -sf "$fic"_64 $fic
    done
)
strip $RPM_BUILD_ROOT%{prefix}/bin/* || :

mkdir -p $RPM_BUILD_ROOT/etc/X11/applnk/Internet
cat > $RPM_BUILD_ROOT/etc/X11/applnk/Internet/ncftp.desktop << EOF
[Desktop Entry]
Name=NcFTP
Comment=NcFTP - a text mode FTP client
Icon=ftp.xpm
Exec=ncftp
Type=Application
Terminal=1
EOF

(cd $RPM_BUILD_ROOT
    mkdir -p usr/bin
    cd usr/bin
    ln -sf ../..%{_prefix}/bin/* .
)

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,system)
%doc 32bit/*README* 32bit/doc 32bit/doc/* 
%config(missingok) /etc/X11/applnk/Internet/ncftp.desktop
%{_prefix}/bin/ncftp*
%{_prefix}/man/man1/ncftp.1*
%{_prefix}/man/man1/ncftpget.1*
%{_prefix}/man/man1/ncftpput.1*
%{_prefix}/man/man1/ncftpbatch.1*
%{_prefix}/man/man1/ncftpls.1*

%changelog
* Wed May 05 2021 Rishita Saha <risaha16@in.ibm.com> - 3.2.6-2
- Update to change license to ClArtistic
- Not shipping files in the /usr directory any longer

* Wed Aug 9 2017 Reshma V Kumar <reskumar@in.ibm.com> - 3.2.6-1
- Update to latest version

* Thu Jul 10 2003 David Clissold <cliss@austin.ibm.com>
- Build with IBM VAC compiler for better size/performance.

* Fri Nov 22 2002 David Clissold <cliss@austin.ibm.com>
- Add IBM ILA license.

* Fri Feb 08 2002 Marc Stephenson <marc@austin.ibm.com>
- New version

* Thu May 17 2001 Marc Stephenson <marc@austin.ibm.com>
- First release of 3.0.3

* Wed Apr 18 2001 David Clissold <cliss@austin.ibm.com>
- Binaries weren't being stripped

* Tue Apr 03 2001 David Clissold <cliss@austin.ibm.com>
- Build with -D_LARGE_FILES enabled (for >2BG files)

* Fri Oct 27 2000 pkgmgr <pkgmgr@austin.ibm.com>
- Modify for AIX Freeware distribution

* Mon Mar  6 2000 Jeff Johnson <jbj@redhat.com>
- permit 8-bit input chars to be returned without exiting (#9981),

* Sat Feb  5 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Deal with rpm compressing man pages
- remove wmconfig stuff

* Thu Jan  6 2000 Jeff Johnson <jbj@redhat.com>
- add missing docs.
- y2k wartlet (#8225)

* Tue Nov  9 1999 Bernhard Rosenkraenzer <bero@redhat.com>
- 3.0b21
- enable signal usage

* Sat Jun 12 1999 Jeff Johnson <jbj@redhat.com>
- 3.0b19

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 3)

* Wed Feb 24 1999 Bill Nottingham <notting@redhat.com>
- return of wmconfig

* Tue Feb 23 1999 Bill Nottingham <notting@redhat.com>
- 3.0b18

* Fri Feb 12 1999 Bill Nottingham <notting@redhat.com>
- 3.0b17

* Wed Dec  2 1998 Bill Nottingham <notting@redhat.com>
- 3.0b16

* Wed Nov 18 1998 Bill Nottingham <notting@redhat.com>
- add docs

* Thu Nov  5 1998 Bill Nottingham <notting@redhat.com>
- update to 3.0beta15

* Thu Aug 13 1998 Jeff Johnson <jbj@redhat.com>
- build root

* Fri Apr 24 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Wed Apr 08 1998 Cristian Gafton <gafton@redhat.com>
- compiled for Manhattan

* Fri Mar 20 1998 Cristian Gafton <gafton@redhat.com>
- updated to 2.4.3 for security reasons

* Wed Nov 05 1997 Donnie Barnes <djb@redhat.com>
- added wmconfig entry

* Wed Oct 21 1997 Cristian Gafton <gafton@redhat.com>
- fixed the spec file

* Fri Oct 10 1997 Erik Troan <ewt@redhat.com>
- updated to ncftp 2.4.2

* Thu Jul 10 1997 Erik Troan <ewt@redhat.com>
- built against glibc

* Tue Mar 25 1997 Donnie Barnes <djb@redhat.com>
- Rebuild as Sun version didn't work.
