# Cgmail Port



## sistematico (Oct 22, 2012)

I read the FreeBSD Porter's Handbook, but I'm still having some doubts, I used the example of the Handbook to try to create a port.


```
# $FreeBSD$

PORTNAME=		cgmail
PORTVERSION=	        0.5
CATEGORIES=		mail
MASTER_SITES=	        https://launchpadlibrarian.net/51644655/

MAINTAINER=		sistematico@gmail.com
COMMENT=		Gnome mail checker relased under GPL terms.

MAN1=			cgmail.1
MANCOMPRESSED=	yes
#USE_IMAKE=		yes
USE_PYDISTUTILS= yes
#USE_GNOME=		gtk20
GCONF_SCHEMAS= 	cgmail.schemas 

.include <bsd.port.mk>
```

Will it work?
Does anyone have a better model?
I can save this Makefile out of /usr/ports?

Someone can help me?


----------



## sistematico (Oct 26, 2012)

```
[root@jazz cgmail]:# make install PREFIX=/var/tmp/`make -V PORTNAME`
===>  Building for cgmail-0.6.2
make: cannot open Makefile.
*** [do-build] Error code 1

Stop in /usr/home/lucas/apps/ports/cgmail.
```


----------



## SirDice (Oct 26, 2012)

sistematico said:
			
		

> Will it work?


You made it, didn't you test it?


----------



## sistematico (Oct 27, 2012)

SirDice said:
			
		

> You made it, didn't you test it?


You're right.
Anyway, I progressed to some extent.

```
# $FreeBSD$

PORTNAME=		cgmail
PORTVERSION=	0.6.2
CATEGORIES=		mail
MASTER_SITES=	https://launchpadlibrarian.net/51644655/
MAINTAINER=		sistematico@gmail.com
COMMENT=		Gnome mail checker relased under GPL terms.

MAN1=			cgmail.1
MANCOMPRESSED=	yes
#NO_BUILD=		yes
#USE_PYDISTUTILS=yes
#USE_GNOME=		gtk20
GCONF_SCHEMAS= 	cgmail.schemas 

do-make:
        cd ${WRKSRC}/${PORTNAME}-${PORTVERSION}/ && ./waf configure --prefix=/usr/local
        cd ${WRKSRC}/${PORTNAME}-${PORTVERSION}/ && ./waf

do-install:
        cd ${WRKSRC}/${PORTNAME}-${PORTVERSION}/ && ./waf install

.include <bsd.port.mk>
```


```
[lucas@jazz cgmail]:$ make
"Makefile", line 18: Need an operator
"Makefile", line 19: Need an operator
"Makefile", line 22: Need an operator
make: fatal errors encountered -- cannot continue
```


----------



## sistematico (Oct 28, 2012)

Some progress.
http://lists.freebsd.org/pipermail/freebsd-ports/2008-January/046332.html



> Spaces won't work:  indentation for commands must use hard tabs.


----------



## sistematico (Oct 28, 2012)

```
[lucas@jazz cgmail]:$ make install
===>  Extracting for cgmail-0.6.2
=> No checksum file (/usr/home/lucas/apps/ports/cgmail/distinfo).
===>  Patching for cgmail-0.6.2
===>  Configuring for cgmail-0.6.2
===>  Building for cgmail-0.6.2
make: cannot open Makefile.
*** [do-build] Error code 1
```


----------



## wblock@ (Oct 28, 2012)

See http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/building.html#using-make.  Probably USE_GMAKE is needed, and I don't think that is the way to do the configure.

Find an existing port that is similar to the new one, and use it as an example.  Also, the freebsd-ports is likely to be more help than the forum.  There are porters here, but more on the list.


----------



## sistematico (Oct 28, 2012)

wblock@ said:
			
		

> See http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/building.html#using-make.  Probably USE_GMAKE is needed, and I don't think that is the way to do the configure.
> 
> Find an existing port that is similar to the new one, and use it as an example.  Also, the freebsd-ports is likely to be more help than the forum.  There are porters here, but more on the list.


Thank you for attention.

BTW, huge progress here:

```
# $FreeBSD$

PORTNAME=		cgmail
PORTVERSION=	0.6.2
CATEGORIES=		mail
MASTER_SITES=	https://launchpadlibrarian.net/51644655/
MAINTAINER=		sistematico@gmail.com
COMMENT=		Gnome mail checker relased under GPL terms

MAN1=			cgmail.1
MANCOMPRESSED=	yes
NO_BUILD=		yes

LIB_DEPENDS=	feedparser:${PORTSDIR}/textproc/py-feedparser

WRKSRC=			${WRKDIR}/${PORTNAME}-${PORTVERSION}

pre-install:
	cd ${WRKSRC} && ./waf configure --prefix=/usr/local
	cd ${WRKSRC} && ./waf

do-install:
	cd ${WRKSRC} && ./waf install

.include <bsd.port.mk>
```
But something wrong with LIB_DEPENDS.

```
# make install
[snip]
...
[snip]
===>   Registering installation for py27-feedparser-5.1.2
===>   Returning to build of cgmail-0.6.2
Error: shared library "feedparser" does not exist
*** [lib-depends] Error code 1

Stop in /usr/home/lucas/apps/ports/cgmail.
```

Im little lost here.


----------



## sistematico (Oct 30, 2012)

Almost done, with big contribution of FreeBSD Ports List and #FreeBSD-br on Freenode.

```
# $FreeBSD$

PORTNAME=		cgmail
PORTVERSION=	0.6.2
CATEGORIES=		mail
MASTER_SITES=	https://launchpadlibrarian.net/51644655/
MAINTAINER=		sistematico@gmail.com
COMMENT=		Gnome mail checker relased under GPL terms
NO_BUILD=		yes

RUN_DEPENDS=	${PYTHON_SITELIBDIR}/feedparser.py:${PORTSDIR}/textproc/py-feedparser
BUILD_DEPENDS=	intltoolize:${PORTSDIR}/textproc/intltool

WRKSRC=			${WRKDIR}/${PORTNAME}-${PORTVERSION}

pre-install:
	cd ${WRKSRC} && ./waf configure --prefix=/usr/local
	cd ${WRKSRC} && ./waf

do-install:
	cd ${WRKSRC} && ./waf install

.include <bsd.port.mk>
```
http://ports.sistematico.org/cgmail.tar.gz

Thank you all, again.


----------



## wblock@ (Oct 30, 2012)

Don't hard-code /usr/local.


----------



## sistematico (Oct 30, 2012)

Thank you, changed to ${PREFIX}.


----------



## sistematico (Oct 31, 2012)

99% done:

```
# $FreeBSD$

PORTNAME=		cgmail
PORTVERSION=	0.6.2
CATEGORIES=		mail
MASTER_SITES=	https://launchpadlibrarian.net/51644655/

MAINTAINER=		sistematico@gmail.com

COMMENT=		Gnome mail checker relased under GPL terms

NO_BUILD=		yes

#BUILD_DEPENDS=	${PYTHON_SITELIBDIR}/py-gnome-desktop:${PORTSDIR}/x11-toolkits/py-gnome-desktop
BUILD_DEPENDS=	${PYTHON_SITELIBDIR}/feedparser.py:${PORTSDIR}/textproc/py-feedparser
BUILD_DEPENDS=	intltoolize:${PORTSDIR}/textproc/intltool

WRKSRC=			${WRKDIR}/${PORTNAME}-${PORTVERSION}

pre-install:
	cd ${WRKSRC} && ./waf configure --prefix=${PREFIX}
	cd ${WRKSRC} && ./waf

do-install:
	cd ${WRKSRC} && ./waf install

.include <bsd.port.mk>
```

Just commented line is wrong, can someone help me?
I can not find the lib name.

SRC: http://ports.sistematico.org/cgmail.tar.gz


----------



## SirDice (Oct 31, 2012)

Replace it with:

```
USE_GNOME=           pygnomedesktop
```


----------



## sistematico (Nov 5, 2012)

Thank you wblock and SirDice!
Someone can test?

```
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	cgmail/
#	cgmail/Makefile
#	cgmail/files
#	cgmail/files/patch-cgmail.py
#	cgmail/files/patch-cgmailservice.py
#	cgmail/distinfo
#	cgmail/pkg-descr
#	cgmail/pkg-plist
#
echo c - cgmail/
mkdir -p cgmail/ > /dev/null 2>&1
echo x - cgmail/Makefile
sed 's/^X//' >cgmail/Makefile << '147cb47d6c779a076d2b1bd0bd00094f'
X# $FreeBSD$
X
XPORTNAME=	cgmail
XPORTVERSION=	0.6.2
XCATEGORIES=	mail
XMASTER_SITES=	https://launchpadlibrarian.net/51644655/
X
XMAINTAINER=	sistematico@gmail.com
XCOMMENT=	Gnome mail checker relased under GPL terms
X
XBUILD_DEPENDS=	${PYTHON_SITELIBDIR}/feedparser.py:${PORTSDIR}/textproc/py-feedparser \
X	intltoolize:${PORTSDIR}/textproc/intltool
X
XGCONF_SCHEMAS=	cgmail.schemas
X
XUSE_GETTEXT=	yes
XWITHOUT_NLS=	yes
XINSTALLS_ICONS=	yes
XUSE_GNOME=	pygnomedesktop
X
Xpost-patch:
X	@${REINPLACE_CMD} -e "s|/bin/bash|${LOCALBASE}/bin/bash|" ${WRKSRC}/cgmail-run.sh
X	@${REINPLACE_CMD} -e "s|/bin/bash|${LOCALBASE}/bin/bash|" ${WRKSRC}/cgmailservice-run.sh
X
Xdo-configure:
X	cd ${WRKSRC} && ./waf configure --prefix=${PREFIX}
X
Xdo-build:
X	cd ${WRKSRC} && ./waf
X
Xdo-install:
X	cd ${WRKSRC} && ./waf install
X
X.include <bsd.port.mk>
147cb47d6c779a076d2b1bd0bd00094f
echo c - cgmail/files
mkdir -p cgmail/files > /dev/null 2>&1
echo x - cgmail/files/patch-cgmail.py
sed 's/^X//' >cgmail/files/patch-cgmail.py << 'ba7d9d651451386b5548a18bcd772113'
X--- cGmail/cgmail.py.orig	2012-10-30 20:22:30.000000000 -0300
X+++ cGmail/cgmail.py	2012-10-30 20:22:49.000000000 -0300
X@@ -33,14 +33,14 @@
X 	gettext.install(package_name, localedir=None, unicode=True,
X 			names=("ngettext",))
X 	# also bind this for gtkbuilder (wtf?)
X-	locale.bindtextdomain(package_name, localedir)
X+	#locale.bindtextdomain(package_name, localedir)
X 	# to load in current locale properly for sorting etc
X 	try:
X 		locale.setlocale(locale.LC_ALL, "")
X 	except locale.Error, e:
X 		pass
X 
X-setup_locale_and_gettext()
X+#setup_locale_and_gettext()
X 
X iface = get_dbus_interface()
X if iface:
ba7d9d651451386b5548a18bcd772113
echo x - cgmail/files/patch-cgmailservice.py
sed 's/^X//' >cgmail/files/patch-cgmailservice.py << 'ade81f39b9c3b7351bc7261c7d37131f'
X--- cGmail/cgmailservice.py.orig	2012-10-30 20:13:56.000000000 -0300
X+++ cGmail/cgmailservice.py	2012-10-30 20:13:21.000000000 -0300
X@@ -33,14 +33,14 @@
X 	gettext.install(package_name, localedir=None, unicode=True,
X 			names=("ngettext",))
X 	# also bind this for gtkbuilder (wtf?)
X-	locale.bindtextdomain(package_name, localedir)
X+	#locale.bindtextdomain(package_name, localedir)
X 	# to load in current locale properly for sorting etc
X 	try:
X 		locale.setlocale(locale.LC_ALL, "")
X 	except locale.Error, e:
X 		pass
X 
X-setup_locale_and_gettext()
X+#setup_locale_and_gettext()
X 
X iface = get_dbus_interface()
X if iface:
ade81f39b9c3b7351bc7261c7d37131f
echo x - cgmail/distinfo
sed 's/^X//' >cgmail/distinfo << '951f27f1aa247e1378e640644f34cec2'
XSHA256 (cgmail-0.6.2.tar.gz) = eda5059d8e29ccd6d0967499c031bc86ddab74a26e11a6f9b90403214e01f2de
XSIZE (cgmail-0.6.2.tar.gz) = 444916
951f27f1aa247e1378e640644f34cec2
echo x - cgmail/pkg-descr
sed 's/^X//' >cgmail/pkg-descr << '17ae4ae1d12fab967b4b5185e9eac6e6'
XcGmail (check gnome mail) is an email checker and notifier applet for the 
Xgnome desktop written in python. cGmail will check periodically your 
Xaccount/s and will notify you on new incoming mails. 
X
XWWW: http://cgmail.tuxfamily.org/
17ae4ae1d12fab967b4b5185e9eac6e6
echo x - cgmail/pkg-plist
sed 's/^X//' >cgmail/pkg-plist << '42320ed529658d7d12380db42b7d4fc8'
Xbin/cgmail
Xbin/cgmailservice
Xshare/applications/cgmail.desktop
Xshare/cgmail/0.png
Xshare/cgmail/1.png
Xshare/cgmail/2.png
Xshare/cgmail/3.png
Xshare/cgmail/4.png
Xshare/cgmail/5.png
Xshare/cgmail/6.png
Xshare/cgmail/7.png
Xshare/cgmail/8.png
Xshare/cgmail/9.png
Xshare/cgmail/account_add_dialog.ui
Xshare/cgmail/accounts_treeview_popupmenu.ui
Xshare/cgmail/accounts_window.ui
Xshare/cgmail/authdialog.ui
Xshare/cgmail/cGmail/__init__.py
Xshare/cgmail/cGmail/__init__.pyc
Xshare/cgmail/cGmail/cgmail.py
Xshare/cgmail/cGmail/cgmail.pyc
Xshare/cgmail/cGmail/cgmailservice.py
Xshare/cgmail/cGmail/cgmailservice.pyc
Xshare/cgmail/cGmail/checkers/__init__.py
Xshare/cgmail/cGmail/checkers/__init__.pyc
Xshare/cgmail/cGmail/checkers/base.py
Xshare/cgmail/cGmail/checkers/base.pyc
Xshare/cgmail/cGmail/checkers/gmailchecker.py
Xshare/cgmail/cGmail/checkers/gmailchecker.pyc
Xshare/cgmail/cGmail/checkers/imapchecker.py
Xshare/cgmail/cGmail/checkers/imapchecker.pyc
Xshare/cgmail/cGmail/checkers/pop3checker.py
Xshare/cgmail/cGmail/checkers/pop3checker.pyc
Xshare/cgmail/cGmail/lib/__init__.py
Xshare/cgmail/cGmail/lib/__init__.pyc
Xshare/cgmail/cGmail/lib/accountmanager.py
Xshare/cgmail/cGmail/lib/accountmanager.pyc
Xshare/cgmail/cGmail/lib/checkersutils.py
Xshare/cgmail/cGmail/lib/checkersutils.pyc
Xshare/cgmail/cGmail/lib/common.py
Xshare/cgmail/cGmail/lib/common.pyc
Xshare/cgmail/cGmail/lib/dicthelper.py
Xshare/cgmail/cGmail/lib/dicthelper.pyc
Xshare/cgmail/cGmail/lib/filedicthelper.py
Xshare/cgmail/cGmail/lib/filedicthelper.pyc
Xshare/cgmail/cGmail/lib/gconfhelper.py
Xshare/cgmail/cGmail/lib/gconfhelper.pyc
Xshare/cgmail/cGmail/lib/imap.py
Xshare/cgmail/cGmail/lib/imap.pyc
Xshare/cgmail/cGmail/lib/iniman.py
Xshare/cgmail/cGmail/lib/iniman.pyc
Xshare/cgmail/cGmail/lib/junkfilter.py
Xshare/cgmail/cGmail/lib/junkfilter.pyc
Xshare/cgmail/cGmail/lib/keyringdicthelper.py
Xshare/cgmail/cGmail/lib/keyringdicthelper.pyc
Xshare/cgmail/cGmail/lib/pop3.py
Xshare/cgmail/cGmail/lib/pop3.pyc
Xshare/cgmail/cGmail/lib/resources.py
Xshare/cgmail/cGmail/lib/resources.pyc
Xshare/cgmail/cGmail/lib/storagehandler.py
Xshare/cgmail/cGmail/lib/storagehandler.pyc
Xshare/cgmail/cGmail/lib/utils.py
Xshare/cgmail/cGmail/lib/utils.pyc
Xshare/cgmail/cGmail/manager/__init__.py
Xshare/cgmail/cGmail/manager/__init__.pyc
Xshare/cgmail/cGmail/manager/accadddialog.py
Xshare/cgmail/cGmail/manager/accadddialog.pyc
Xshare/cgmail/cGmail/manager/accountswindow.py
Xshare/cgmail/cGmail/manager/accountswindow.pyc
Xshare/cgmail/cGmail/manager/dbusinterface.py
Xshare/cgmail/cGmail/manager/dbusinterface.pyc
Xshare/cgmail/cGmail/manager/junkfilterdialog.py
Xshare/cgmail/cGmail/manager/junkfilterdialog.pyc
Xshare/cgmail/cGmail/manager/preferencesdialog.py
Xshare/cgmail/cGmail/manager/preferencesdialog.pyc
Xshare/cgmail/cGmail/service/__init__.py
Xshare/cgmail/cGmail/service/__init__.pyc
Xshare/cgmail/cGmail/service/checkersrunner.py
Xshare/cgmail/cGmail/service/checkersrunner.pyc
Xshare/cgmail/cGmail/service/dbusinterface.py
Xshare/cgmail/cGmail/service/dbusinterface.pyc
Xshare/cgmail/cGmail/service/mainloop.py
Xshare/cgmail/cGmail/service/mainloop.pyc
Xshare/cgmail/cGmail/service/statusicon.py
Xshare/cgmail/cGmail/service/statusicon.pyc
Xshare/cgmail/cGmail/service/statuslistener.py
Xshare/cgmail/cGmail/service/statuslistener.pyc
Xshare/cgmail/cGmail/service/statusnotifier.py
Xshare/cgmail/cGmail/service/statusnotifier.pyc
Xshare/cgmail/cgmail.png
Xshare/cgmail/cgmail.py
Xshare/cgmail/cgmail.pyc
Xshare/cgmail/cgmail.svg
Xshare/cgmail/cgmailservice.desktop
Xshare/cgmail/cgmailservice.py
Xshare/cgmail/cgmailservice.pyc
Xshare/cgmail/gmail.png
Xshare/cgmail/imap.png
Xshare/cgmail/junkfilter_dialog.ui
Xshare/cgmail/junkfilter_popupmenu.ui
Xshare/cgmail/mail.png
Xshare/cgmail/malert.png
Xshare/cgmail/nomail.png
Xshare/cgmail/notify.wav
Xshare/cgmail/pop3.png
Xshare/cgmail/preferences_dialog.ui
Xshare/cgmail/statusicon_popupmenu.ui
Xshare/cgmail/sync_cgmail.png
Xshare/icons/hicolor/icon-theme.cache
Xshare/icons/hicolor/scalable/apps/cgmail.svg
Xshare/locale/ar/LC_MESSAGES/cgmail.mo
Xshare/locale/br/LC_MESSAGES/cgmail.mo
Xshare/locale/ca/LC_MESSAGES/cgmail.mo
Xshare/locale/cs/LC_MESSAGES/cgmail.mo
Xshare/locale/de/LC_MESSAGES/cgmail.mo
Xshare/locale/el/LC_MESSAGES/cgmail.mo
Xshare/locale/es/LC_MESSAGES/cgmail.mo
Xshare/locale/et/LC_MESSAGES/cgmail.mo
Xshare/locale/fr/LC_MESSAGES/cgmail.mo
Xshare/locale/gl/LC_MESSAGES/cgmail.mo
Xshare/locale/he/LC_MESSAGES/cgmail.mo
Xshare/locale/it/LC_MESSAGES/cgmail.mo
Xshare/locale/nb/LC_MESSAGES/cgmail.mo
Xshare/locale/nl/LC_MESSAGES/cgmail.mo
Xshare/locale/pl/LC_MESSAGES/cgmail.mo
Xshare/locale/pt_BR/LC_MESSAGES/cgmail.mo
Xshare/locale/ru/LC_MESSAGES/cgmail.mo
Xshare/locale/sv/LC_MESSAGES/cgmail.mo
Xshare/locale/uk/LC_MESSAGES/cgmail.mo
Xshare/locale/zh_CN/LC_MESSAGES/cgmail.mo
Xshare/locale/zh_TW/LC_MESSAGES/cgmail.mo
X@dirrm share/cgmail
42320ed529658d7d12380db42b7d4fc8
exit
```

To test:

```
# cd /tmp
# fetch "https://www.friendpaste.com/pGNFOG6TDq3TBwe98oB23/raw"
# mv raw cgmail.shar
# sh cgmail.shar
# cd cgmail
# make install clean
# exit
# su - user
$ rahash
$ cgmailservice
```

Screenshot: http://imageshack.us/a/img24/6346/cgmail.png (thumbnails allowed?)

Thank you all, sorry for bad English, and maybe buggy port?


----------



## wblock@ (Nov 5, 2012)

I'm not equipped to test, but you can't assume bash will be present to use.  You could add a dependency on it, but better would be to see if the sh stuff it does will run in sh(1) and substitute that.

Use ports-mgmt/portlint.


----------

