# How to creat pkg-plist file for a new port



## DarkLord (Aug 10, 2014)

Hello, I am trying to make a new port for a program called Deja-Dup and since this is my first port, I am having issues figuring out all the details. I created a simple Makefile, but am having issues figuring out how to create a pkg-plist file. I read pkg-create(8) as this command was mentioned in the Porter's Handbook, but I don't see how it helps me with creating this file, so since I wasn't sure how to know which files would be installed, I wanted to try the automated way of creating the packing list using `make makeplist`. However, it seems like this command doesn't fetch the dependencies required for Deja-Dup to compile, so I get errors. I think there is probably a good way to solve this problem, but I don't know how. Could someone point me in the right direction?

Here is my Makefile (with my email address/identifying information removed)

```
# $FreeBSD$

PORTNAME=      deja-dup
PORTVERSION=   30.0
CATEGORIES=    archivers
MASTER_SITES=  https://launchpad.net/deja-dup/30/30.0/+download/

MAINTAINER=
COMMENT=       Graphical file backup utility using duplicity as its backend

EXTRACT_SUFX=  .tar.xz

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

Now when I call `make makeplist`, I end up with a bunch of errors because of package dependencies that aren't installed yet. Here is a relevant sample of the output

```
-- checking for module 'libnautilus-extension'
--   package 'libnautilus-extension' not found
-- checking for module 'libunity-control-center'
--   package 'libunity-control-center' not found
-- checking for module 'unity>=3.4.2'
--   package 'unity>=3.4.2' not found
-- Configuring incomplete, errors occurred!
See also "/usr/ports/archivers/deja-dup/work/deja-dup-30.0/builddir/CMakeFiles/CMakeOutput.log".
*** [builddir] Error code 1

make[1]: stopped in /usr/ports/archivers/deja-dup/work/deja-dup-30.0
1 error

make[1]: stopped in /usr/ports/archivers/deja-dup/work/deja-dup-30.0
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/archivers/deja-dup
```
Any help is appreciated. Thanks!


----------



## olivierd (Aug 10, 2014)

Hi,

According to build log, your Makefile is unfinished (there're no dependencies).

Here, something more complete (not tested).


```
[...]

COMMENT=        Graphical file backup utility using duplicity as its backend
 
LICENSE=        GPLv3
LICENSE_FILE=   ${WRKSRC}/COPYING
 
BUILD_DEPENDS=  valac:${PORTSDIR}/lang/vala
LIB_DEPENDS=    libnotify.so:${PORTSDIR}/devel/libnotify \
        libpeas-1.0.so:${PORTSDIR}/devel/libpeas \
        libsecret-1.so:${PORTSDIR}/security/libsecret
 
USES=   cmake pkgconfig gettext tar:xz
USE_GNOME=      glib20 gtk30
INSTALLS_ICONS= yes
 
GLIB_SCHEMAS=   org.gnome.DejaDup.gschema.xml

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

Dependencies found in CMakeLists.txt, you also need sysutils/polkit (pkexec is used).

In libdeja/CommonUtils.vala check if Linux utilities (ionice, nice, replace some tests) exist under FreeBSD.

Then disable Unity, and Nautilus options, if everything success, you can run `make makeplist > pkg-plist` and test your port.

Good luck


----------



## DarkLord (Aug 11, 2014)

Thanks for the response! I did a few modifications as suggested and then worked through a few other issues, but I've gotten stuck again. Now the port fails to compile because it complains that it can't find libsecret-1. Here's my current Makefile:

```
# $FreeBSD$

PORTNAME=       deja-dup
PORTVERSION=    30.0
CATEGORIES=     archivers
MASTER_SITES=   https://launchpad.net/deja-dup/30/30.0/+download/
EXTRACT_SUFX=   .tar.xz

MAINTAINER=     
COMMENT=        Graphical file backup utility using Duplicity as its backend

LICENSE=        GPLv3
LICENSE_FILE=   ${WRKSRC}/COPYING

LIB_DEPENDS=    libnotify.so:${PORTSDIR}/devel/libnotify \
                libpeas-1.0.so:${PORTSDIR}/devel/libpeas \
                libsecret-1.so:${PORTSDIR}/security/libsecret
BUILD_DEPENDS=  valac:${PORTSDIR}/lang/vala \
                itstool:${PORTSDIR}/textproc/itstool

USE_LDCONFIG=   yes
USES=           cmake pkgconfig gettext
USE_GNOME=      glib20 gtk30
INSTALLS_ICONS= yes

GLIB_SCHEMAS=   org.gnome.DejaDup.gschema.xml

.include <bsd.port.mk>
```
I have attached the output I get when I type `make makeplist`, but here is the part where it fails:

```
Scanning dependencies of target deja-dup-preferences.desktop
[  2%] Generating AsyncCommand.c, Backend.c, BackendAuto.c, BackendFile.c, BackendRackspace.c, BackendS3.c, BackendU1.c, Checker.c, CommonUtils.c, DirHandling.c, FilteredSettings.c, Network.c, Operation.c, OperationBackup.c, OperationFiles.c, OperationRestore.c, OperationStatus.c, OperationVerify.c, PythonChecker.c, RecursiveDelete.c, RecursiveMove.c, RecursiveOp.c, ToolPlugin.c, deja.vapi, deja.h, deja_internal.h
error: Package `libsecret-1' not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 1 error(s), 0 warning(s)
--- libdeja/AsyncCommand.c ---
*** [libdeja/AsyncCommand.c] Error code 1
```
It seems like libsecret-1 is being installed correctly, but then Vala is looking in the wrong place for it. Is that correct? If that's the case, then would I probably need some sort of script (in the pre-build stage?) to set Vala to look in the right place (or maybe do a soft link from where Vala is already looking to where libsecret-1 is stored)? If I'm looking the wrong direction, please correct me. Also, if you see other issues with my Makefile please comment. Thanks for the help!


----------



## olivierd (Aug 11, 2014)

In your Makefile, replace EXTRACT_SUFX by 
	
	



```
USES= tar:xz
```
 like I previously wrote.

I know why Vala fails with libsecret, because in the current port Vala bindings are disabled. You need to reinstall this port with Vala support, and open a PR.


----------



## olivierd (Aug 11, 2014)

Here patch for security/libsecret with Vala support.


----------



## DarkLord (Aug 12, 2014)

Okay, I now have 
	
	



```
USES= tar:xz
```
 to specify it is in .tar.xz format. I'm curious though - is this just a stylistic convention that is good to follow, or is it actually different from EXTRACT_SUFX in some significant way?

Thanks for that patch! I will work on getting it into the right hands. Now I can finally run `make makeplist` without errors! Time for the rest of the port testing now.


----------



## kpa (Aug 12, 2014)

DarkLord said:
			
		

> Okay, I now have
> 
> 
> 
> ...



The difference between EXTRACT_SUFX and USES= tar:xz is that the latter is where the whole ports(7) system is now moving towards and the first form will disappear soon when no port is using it anymore. The USES= system is much more manageable and results in cleaner port Makefiles.


----------



## DarkLord (Aug 13, 2014)

Thanks for that tidbit of knowledge.

I was testing my port and realized something that made me think of a more general question. In general, how do you know the dependencies required when porting a piece of software? Is it trial and error, reading the original source code, or something else? With my port I realized I had forgotten to list duplicity as a dependency, but I only knew that from my general knowledge of Deja-Dup, so I'm curious how I would have come to known that by another method. Anyway, now that I have remembered duplicity is needed for Deja-Dup to function, am I correct in my assertion that it would be considered a run-time dependency? Which would mean I would have to add the line 
	
	



```
RUN_DEPENDS= duplicity:${PORTSDIR}/sysutils/duplicity
```


----------

