How to build YPOPs! RPM for Fedora Core 3

by birko bergt on 2005-04-02

Intro

YPOPs! is an application that provides POP3 access to Yahoo! Mail. It is available on the Windows, Linux, Solaris and Mac platforms. For more information take a look at YPOPs! at SourceForge.net.

Here you will find a step by step guide to build binary RPM packages of the YPOPs! application.

Downloadable Files

I'll be using the current CVS sources version 0.74 from YPOPs! CVS.

The MIMEPP-Library version 1.3.3 referenced in the CVS sources is hard to find on the web so you have to search a bit for it. If you find a mac version just use this. It compiles fine on linux too.
I've done some changes in the shell script ypops.sh and added the init script ypops.init. You have to place these scripts into the YPOPs! src directory to get a working install for the RPM.

Now you need the RPM SPEC file - ypops-0.7.4.spec.

Downloads

Step by step guide

Let's begin: (Make sure you have created rpmbuild directory in your own home.)

Preparation

Take a look at YPOPs! CVS instrucation page and get a recent copy of the source code. As password just hit the enter button on your keyboard.
[bergt@kyron5 ~]$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/yahoopops login
Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/yahoopops
CVS password:
[bergt@kyron5 ~]$

Now you can fetch the sources from the repository. You have to checkout the modulename yahoopops.

[bergt@kyron5 ~]$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/yahoopops co -P yahoopops
cvs checkout: Updating yahoopops
U yahoopops/.cvsignore
U yahoopops/Website.url
U yahoopops/ypops.iss
cvs checkout: Updating yahoopops/docs
U yahoopops/docs/credits.txt
U yahoopops/docs/history.html
U yahoopops/docs/install_license.txt
U yahoopops/docs/license.txt
...
cvs checkout: Updating yahoopops/src/res
U yahoopops/src/res/YPOPs.ico
U yahoopops/src/res/YPOPs.rc2
U yahoopops/src/res/config_folder_leaf.ico
U yahoopops/src/res/config_folder_root.ico
[bergt@kyron5 ~]$

You should find now a local directory yahoopops containing some subdirectories and some files.

[bergt@kyron5 ~]$ ls -l
drwxrwxr-x  6 bergt bergt   4096  3. Apr 00:02 yahoopops
[bergt@kyron5 ~]$ ls -l yahoopops/
insgesamt 56
drwxrwxr-x  2 bergt bergt 4096  3. Apr 00:02 CVS
drwxrwxr-x  3 bergt bergt 4096  3. Apr 00:02 docs
drwxrwxr-x  4 bergt bergt 4096  3. Apr 00:02 lib
drwxrwxr-x  5 bergt bergt 4096  3. Apr 00:02 src
-rw-rw-r--  1 bergt bergt   85 30. Jan 22:58 Website.url
-rw-rw-r--  1 bergt bergt 8784 19. Mar 10:56 ypops.iss
[bergt@kyron5 ~]$

Rename the yahoopops directory into ypops-0.7.4 and check if you got the right version from CVS.

[bergt@kyron5 ~]$ mv yahoopops ypops-0.7.4
[bergt@kyron5 ~]$ cd ypops-0.7.4
[bergt@kyron5 ypops-0.7.4]$ grep VER ypops.iss
#define VER "0.7.4"
VersionInfoVersion={#VER}
VersionInfoDescription=YPOPs! {#VER}
AppVerName=YPOPs! {#VER}
OutputBaseFilename=ypops-win-{#VER}
[bergt@kyron5 ypops-0.7.4]$

If you see the version number 0.7.4 all's well.

Next install the source code for MIMEPP into the ypops-lib-directory.

[bergt@kyron5 ypops-0.7.4]$ cd lib
CVS  re_lib
[bergt@kyron5 lib]$ wget http://XXXXX.freewebpages.org/XXXXXX/XXXXpp-mac.tar.bz2
--00:24:47--  http://XXXXX.freewebpages.org/XXXXXX/XXXXpp-mac.tar.bz2
           => `XXXXpp-mac.tar.bz2'
Resolving XXXXX.freewebpages.org... AAA.BB.CC.DD
Connecting to XXXXX.freewebpages.org[AAA.BB.CC.DD]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]

    [            <=>                      ] 271,029       93.67K/s

00:24:50 (93.36 KB/s) - `XXXXpp-mac.tar.bz2' saved [271,029]

[bergt@kyron5 lib]$ bunzip2 -v XXXXpp-mac.tar.bz2
  XXXXpp-mac.tar.bz2: done
[bergt@kyron5 lib]$ tar xvvf XXXXpp-mac.tar
drwxr-xr-x osdndevel/wheel   0 2004-08-24 14:34:49 mimepp/
-rw-r--r-- osdndevel/wheel 1698 2003-08-08 11:10:43 mimepp/00-Readme.txt
-rw-r--r-- osdndevel/wheel 17193 2003-08-08 11:10:43 mimepp/Changes.txt
-rw-r--r-- osdndevel/wheel   683 2003-08-08 11:10:43 mimepp/Copyright.txt
drwxr-xr-x osdndevel/wheel     0 2004-08-24 12:55:50 mimepp/dbg/
drwxr-xr-x osdndevel/wheel     0 2003-08-08 11:10:50 mimepp/doc/
-rw-r--r-- osdndevel/wheel  4862 2003-08-08 11:10:49 mimepp/doc/address.htm
-rw-r--r-- osdndevel/wheel 12845 2003-08-08 11:10:49 mimepp/doc/addrlist.htm
-rw-r--r-- osdndevel/wheel 12254 2003-08-08 11:10:49 mimepp/doc/applfile.htm
-rw-r--r-- osdndevel/wheel  7716 2003-08-08 11:10:49 mimepp/doc/binhex.htm
...
-rw-r--r-- osdndevel/wheel  1221 2003-08-08 11:10:45 mimepp/src/system.cpp
-rw-r--r-- osdndevel/wheel 11424 2003-08-08 11:10:45 mimepp/src/text.cpp
-rw-r--r-- osdndevel/wheel 14562 2003-08-08 11:10:45 mimepp/src/token.cpp
-rw-r--r-- osdndevel/wheel 12513 2003-08-08 11:10:45 mimepp/src/uuencode.cpp
-rw-r--r-- osdndevel/wheel 23178 2003-08-08 11:10:43 mimepp/Tutorial.htm
-rw-r--r-- osdndevel/wheel 22276 2003-08-08 11:10:44 mimepp/Tutorial.txt
[bergt@kyron5 lib]$ ls -l
total 1972
drwxrwxr-x  2 bergt bergt    4096 Apr  3 00:02 CVS
drwxr-xr-x  6 bergt bergt    4096 Aug 24  2004 mimepp
drwxrwxr-x  3 bergt bergt    4096 Apr  3 00:02 re_lib
[bergt@kyron5 lib]$ mv mimepp mimepp-mac
[bergt@kyron5 lib]$ ls -l
total 1972
drwxrwxr-x  2 bergt bergt    4096 Apr  3 00:02 CVS
drwxr-xr-x  6 bergt bergt    4096 Aug 24  2004 mimepp-mac
drwxrwxr-x  3 bergt bergt    4096 Apr  3 00:02 re_lib
[bergt@kyron5 lib]$

Now we have all source code we need in place. Let's go to the Makefile from YPOPs! and correct the path names to the MIMEPP-Library and the paths for the binary too. The YPOPs! sources lives in the src directory. Use the vi to change the Makefile after you have made a copy.

[bergt@kyron5 lib]$ cd ../src
[bergt@kyron5 src]$ ls
CVS                             Defines.h               UpdateYPOPsDlg.h
ConfigAdvancedPage.cpp          DisclaimerDlg.cpp       WebBrowser.cpp
ConfigAdvancedPage.h            DisclaimerDlg.h         WebBrowser.h
ConfigEmailPage.cpp             Email.cpp               WinHelp
ConfigEmailPage.h               Email.h                 YPOPs.cpp
ConfigEmailPreferencesPage.cpp  HttpClient.cpp          YPOPs.h
ConfigEmailPreferencesPage.h    HttpClient.h            YPOPs.rc
ConfigFoldersPage.cpp           HttpClientResponse.cpp  YahooSessionCache.cpp
ConfigFoldersPage.h             HttpClientResponse.h    YahooSessionCache.h
ConfigLogPage.cpp               HttpSession.cpp         YahooStuff.cpp
ConfigLogPage.h                 HttpSession.h           YahooStuff.h
ConfigMailSmtpPage.cpp          HyperLink.cpp           mainfrm.cpp
ConfigMailSmtpPage.h            HyperLink.h             mainfrm.h
ConfigMiscPage.cpp              LogFile.cpp             pure_api.c
ConfigMiscPage.h                LogFile.h               res
ConfigNetworkPage.cpp           Makefile                resource.h
ConfigNetworkPage.h             OptionsTreeDlg.cpp      stdafx.cpp
ConfigProxyPage.cpp             OptionsTreeDlg.h        stdafx.h
ConfigProxyPage.h               ProgressWnd.cpp         trayicon.cpp
ConfigSecurityPage.cpp          ProgressWnd.h           trayicon.h
ConfigSecurityPage.h            README.unix-linux       vsscanf.cpp
ConfigureDlg.cpp                ServiceClient.cpp       vsscanf.h
ConfigureDlg.h                  ServiceClient.h         ypops.clw
CustomPropertyPage.cpp          SmtpListener.cpp        ypops.dsp
CustomPropertyPage.h            SmtpListener.h          ypops.dsw
DataHolder.cpp                  StdString.h             ypops.sh
DataHolder.h                    UpdateYPOPsDlg.cpp      ypops_samplerc
[bergt@kyron5 src]$ cp Makefile Makefile.orig
[bergt@kyron5 src]$

I've done the following changes to the Makefile.

[bergt@kyron5 src]$ diff Makefile.orig Makefile
9,11c9,11
< INSTALL_DIR   = /usr/local/bin
< RUN_DIR       = /usr/local/ypops
< MIMEPP                = ../lib/mimepp-1.3.3
---
> INSTALL_DIR   = /usr/bin
> RUN_DIR       = /etc/ypops
> MIMEPP                = ../lib/mimepp-mac
14,17c14,17
< CURL_INC      = /usr/local/include
< SSL_INC       = /usr/local/ssl/include
< CURL_LIB      = /usr/local/lib
< SSL_LIB       = /usr/local/ssl/lib
---
> CURL_INC      = /usr/include/curl
> SSL_INC       = /usr/include/openssl
> CURL_LIB      = /usr/lib
> SSL_LIB       = /usr/lib
[bergt@kyron5 src]$

Now you can try a first make

[bergt@kyron5 src]$ make
rm -f ypops
make mimelib;make libre_lib;make ypops
make[1]: Entering directory `/home/bergt/tmp/ypops-0.7.4/src'
cd ../lib/mimepp-mac;make -f makefile-unix rel_lib;cd
make[2]: Entering directory `/home/bergt/tmp/ypops-0.7.4/lib/mimepp-mac'
mkdir ./rel
g++ -c -DDW_UNIX -DDW_PRODUCTION_VERSION -D_REENTRANT -fexceptions -I./src ./src
/address.cpp -o ./rel/address.o
In File, included from ./src/address.cpp:25:
./src/mimepp/config.h:37:1: Warning: "DW_UNIX" redefined
:2:1: Warning: this is the location of the previous definition
...
g++ -g -fkeep-inline-functions -fno-default-inline -g -D_REENTRANT -I../lib/re_l
ib -I../lib/mimepp-mac/src -I../lib/mimepp-mac/examples/email -I/usr/include/cur
l -I/usr/include/openssl -o ypops DataHolder.o Email.o HttpClient.o HttpClientRe
sponse.o HttpSession.o LogFile.o ServiceClient.o SmtpListener.o WebBrowser.o YPO
Ps.o YahooSessionCache.o YahooStuff.o vsscanf.o EmailMessage.o EmailAttach.o Ema
ilAttachList.o EmailText.o EmailDate.o EmailAddress.o EmailAddressList.o ../lib/
re_lib/libre_lib.a ../lib/mimepp-mac/rel/libmimepp_core.a ../lib/mimepp-mac/rel/
libmimepp_util.a ../lib/mimepp-mac/rel/libmimepp_net.a -lstdc++ -lpthread -lnsl 
-ldl  -lz -L/usr/lib -L/usr/lib -lcurl -lssl -lcrypto
make[1]: Leaving directory `/home/bergt/tmp/ypops-0.7.4/src'
[bergt@kyron5 src]$

Don't worry about the Warnings from the redefined "DW_UNIX". If you don't see other errors all is still well and you should end up with a binary ypops in the src directory.

[bergt@kyron5 src]$ ls -l ypops
-rwxrwxr-x  1 bergt bergt 1713160 Apr  3 00:41 ypops
[bergt@kyron5 src]$

Just type a make clean to remove all the object files and the binary stuff from the src directory. To make the lib directory clean it's a bit more complicated. Let's see!

[bergt@kyron5 src]$ make clean
rm -f DataHolder.o Email.o HttpClient.o HttpClientResponse.o HttpSession.o LogFi
le.o ServiceClient.o SmtpListener.o WebBrowser.o YPOPs.o YahooSessionCache.o Yah
ooStuff.o vsscanf.o EmailMessage.o EmailAttach.o EmailAttachList.o EmailText.o E
mailDate.o EmailAddress.o EmailAddressList.o ypops core
[bergt@kyron5 src]$ cd ../lib
[bergt@kyron5 lib]$ cd mimepp-mac/rel
[bergt@kyron5 rel]$ ls
address.o   disptype.o  group.o           message.o   string.o
addrlist.o  dw_cte.o    headers.o         msgcmp.o    system.o
applfile.o  dw_date.o   libmimepp_core.a  msgid.o     text.o
binhex.o    dw_mime.o   libmimepp_net.a   nntp.o      token.o
body.o      encoded.o   libmimepp_util.a  param.o     uuencode.o
bodypart.o  entity.o    mailbox.o         pop.o
bounds.o    except.o    mboxlist.o        protocol.o
boyermor.o  field.o     mechansm.o        smtp.o
datetime.o  fieldbdy.o  mediatyp.o        stamp.o
[bergt@kyron5 rel]$ rm *.o *.a
[bergt@kyron5 rel]$ cd ../../re_lib/
[bergt@kyron5 re_lib]$  make -f makefile.unix clean
rm -f regexp.o regerror.o regsub.o timer.o try.o \
        timer.t.h dMakefile dtr try timer libre_lib.a \
        core mon.out
[bergt@kyron5 re_lib]$

Don't forget to copy the startup file ypops.sh and the init script ypops.init to the proper location in the source tree. They should live in the src directory.

[bergt@kyron5 re_lib]$ cd ../../src
[bergt@kyron5 src]$ mv ~/ypops.sh .
[bergt@kyron5 src]$ mv ~/ypops.init .

Now we have a clean and functioning source tree for YPOPs! including a compilable MIMEPP-Library and new startup and init scripts. This should be saved in a tar archiv.

[bergt@kyron5 src]$ cd ../../
[bergt@kyron5 ~]$ tar cvzf ypops-0.7.4.tar.gz ypops-0.7.4
ypops-0.7.4/
ypops-0.7.4/CVS/
ypops-0.7.4/CVS/Root
ypops-0.7.4/CVS/Repository
ypops-0.7.4/CVS/Entries
ypops-0.7.4/docs/
ypops-0.7.4/docs/CVS/
ypops-0.7.4/docs/CVS/Root
ypops-0.7.4/docs/CVS/Repository
ypops-0.7.4/docs/CVS/Entries
ypops-0.7.4/docs/credits.txt
ypops-0.7.4/docs/history.html
ypops-0.7.4/docs/install_license.txt
ypops-0.7.4/docs/license.txt
...
ypops-0.7.4/src/res/CVS/Entries
ypops-0.7.4/src/res/YPOPs.ico
ypops-0.7.4/src/res/YPOPs.rc2
ypops-0.7.4/src/res/config_folder_leaf.ico
ypops-0.7.4/src/res/config_folder_root.ico
ypops-0.7.4/src/Makefile.orig
ypops-0.7.4/src/typescript
[bergt@kyron5 ~]$ ls -l ypops-0.7.4.tar.gz
-rw-rw-r--  1 bergt bergt 1072465 Apr  3 00:57 ypops-0.7.4.tar.gz
[bergt@kyron5 ~]$ 

Build the RPM

(Once again: Make sure you have created rpmbuild directoryi in your own home.)

Copy or move the SPEC file to your local rpmbuild/SPECS directory.

[bergt@kyron5 ~]$ mv ypops-0.7.4.spec rpmbuild/SPECS/
[bergt@kyron5 ~]$ 

Copy or move your newly created YPOPs! tarball into the rpmbuild/SOURCES directory.

[bergt@kyron5 ~]$ mv ypops-0.7.4.tar.gz rpmbuild/SOURCES/
[bergt@kyron5 ~]$ 

Now you may try a rpmbuild. We use the -bb option to build a binary RPM only. If you like to build a source RPM too just use the -ba option instead.

[bergt@kyron5 ~]$ rpmbuild -bb rpmbuild/SPECS/ypops-0.7.4.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.52319
+ umask 022
+ cd /home/bergt/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/ypops-0.7.4-buildroot
+ cd /home/bergt/rpmbuild/BUILD
+ rm -rf ypops-0.7.4
+ /usr/bin/gzip -dc /home/bergt/rpmbuild/SOURCES/ypops-0.7.4.tar.gz
+ tar -xf -
+ STATUS=0
...
+ cp -pr docs/credits.txt docs/history.html docs/install_license.txt docs/licen
se.txt docs/outlook_errormessages.htm docs/team.html docs/todo.txt docs/wincvs.
doc /var/tmp/ypops-0.7.4-buildroot/usr/share/doc/ypops-0.7.4
+ exit 0
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/ypops-0.7.4-b
uildroot
Wrote: /home/bergt/rpmbuild/RPMS/i386/ypops-0.7.4-0.FC3.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.39276
+ umask 022
+ cd /home/bergt/rpmbuild/BUILD
+ cd ypops-0.7.4
+ rm -rf /var/tmp/ypops-0.7.4-buildroot
+ exit 0
[bergt@kyron5 ~]$ 

Check the output for error messages and if you find the freshly rolled ypops-0.7.4-0.FC3.i386.rpm in the rpmbuild/RPMS/i386 directory you are nearly done.

The last step is to sign your fresh build RPM with your GnuPG-Key. To find out how to setup your rpmbuild enviroment to sign RPM packages please take a look at Thomas Chung's How to sign your custom RPM package with GPG Key.

[bergt@kyron5 ~]$ rpm --addsign rpmbuild/RPMS/i386/ypops-0.7.4-0.FC3.i386.rpm
Enter pass phrase:
Pass phrase is good.
rpmbuild/RPMS/i386/ypops-0.7.4-0.FC3.i386.rpm:
[bergt@kyron5 ~]$

To check the signiature typ a rpm --checksig

[bergt@kyron5 ~]$ rpm --checksig rpmbuild/RPMS/i386/ypops-0.7.4-0.FC3.i386.rpm
rpmbuild/RPMS/i386/ypops-0.7.4-0.FC3.i386.rpm: (sha1) dsa sha1 md5 gpg OK
[bergt@kyron5 ~]$

If you like to install your ypops-0.7.4-0.FC3.i386.rpm package just go to the How to install YPOPs! RPM for Fedora Core 3.