creating and installing packages

lm8

Member


Messages: 22

I have some programs I want to build on my machine which I've previously built on some other operating systems using the standard gnu configure/make/patch utilities and a bash script to automate the process. I checked the ports directory and there are not already ports for these applications. What's the fastest, easiest and best way to get these applications built and installed properly on FreeBSD? If I just build them using the bash script and install them, they're not part of the package management system (cannot be handled or viewed with pkg_add, pkg_info, etc.). I read through the Porter's Handbook. It seems pretty complicated to build Makefile and related files. Is there a way to automate the process more or does this have to be done by hand for each application? Is there a way to skip the Makefile and just create a binary package with the proper files to use with pkg_add? I'm looking for some tips to automating the package creation process. My other thought was to use two package management systems one for FREEBSD related packages and one for tarballs I build locally on the machine that have no ports available. I think that might get messy though. Any suggestions on good options for creating and installing binary packages if the ports for the applications don't already exist? Help, suggestions, pros and cons, appreciated. Thanks.
 

phoenix

Administrator
Staff member
Administrator
Moderator

Reaction score: 1,230
Messages: 4,079

Build a port for it. Building a port is not all that complicated, it really depends on how complicated the application makes its build process.

A simple port can be done by just setting the following in the port Makefile:
  • PORTNAME=<the name of the port>
  • PORTVERSION=<the port version>
  • CATEGORIES=<a list of categories the port fits into>
  • MASTER_SITES=<the main web/ftp site to download the source from>
  • MAINTAINER=<the e-mail address of the person who created/maintains the port>
  • COMMENT=<a one line description of the port>
  • GNU_CONFIGURE=yes (if it has a GNU ./configure script)
  • CONFIGURE_ARGS= (the list of arguments to pass to ./configure)

Beyond that, you add RUN_DEPENDS for any existing ports that this one depends on in order to run; LIB_DEPENDS for any libraries it depends on, BUILD_DEPENDS for any ports that it needs in order to build.

After that, it's just iterations of "ee Makefile", "make build", "make install", and "make deinstall", until you fix all the issues and have a working port. Then you submit it as a PR and someone reviews it, and sends you back a list of things to fix. And eventually it gets into the ports tree.

Just follow the porter's handbook. It's not all that hard, as you can skip the sections that don't apply (no GNOME/KDE/X11 dependencies, then don't bother with those sections of the handbook).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,292
Messages: 29,742

It's not that hard to create a basic port, provided your application doesn't need much more then configure and make. I believe a simple port skeleton is in the porters handbook somewhere in the beginning.

To get a package created you will need a port anyway :e
 
OP
OP
L

lm8

Member


Messages: 22

Thanks for the example and the advice. I tried writing a simple makefile for one of the programs I want to run. I can get ./configure and make (aka gmake) to run okay using GNU_CONFIGURE=yes, USE_GMAKE=yes in the FreeBSD Makefile. How do you replace or denote the make install DESTDIR=$PKGDIR step? Would like to send all the files that need to be part of the package to a specific location and use that to install from. Can you use the install part of GNU make style makefiles or do you need to specify install macros (like INSTALL_PROGRAM) in the FREEBSD makefile for each file that needs to be part of the final package?
 
Top