LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 07-24-2006, 10:37 AM   #1
geletine
Member
 
Registered: Apr 2005
Distribution: Slackware
Posts: 213
Blog Entries: 2

Rep: Reputation: 30
Creating own packages


How would i create a package in freebsd if the src was not in ports?
 
Old 07-24-2006, 11:59 AM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
The "easy" way is to make your own port. It's cleaner and allows for nicer upgrades... usually. But that depends on how involved you are and how committed you are to the project.

If you are too lazy for that (and that's okay too) you'll want to read the manpage for pkg_create(1) http://www.freebsd.org/cgi/man.cgi?query=pkg_create

Basically, you create a file which lists all the files installed by the program (offset from the prefix you specify). So if I installed foobar (a sample program I wrote) in /usr/local/bin then the file would have
Code:
bin/foobar
and the prefix would be set to /usr/local

You create a couple description files (short one line, and longer one)... and specify anything else your program needs to install cleanly from those programs (possibly a script to add the program to /etc/shells if it is a new shell and one to remove it upon deinstallation).

Read the man page and play around with it until you get something which is exactly what you want.

If this program is at all complicated... you can use programs to help generate some of these files. For example, a find search before and after you install the program with a diff will show you all the files installed by the program (if you don't know exactly what it does) and so on.
 
Old 07-24-2006, 12:21 PM   #3
geletine
Member
 
Registered: Apr 2005
Distribution: Slackware
Posts: 213

Original Poster
Blog Entries: 2

Rep: Reputation: 30
maybe i am not understanding, but it seems like a lot of work, say for instance i download src from a svn and i compile it like normal .. ./configure --flags.. && gmake && gmake install DESTDIR=/tmp/foo , then i would goto /tmp/foo and type all the files into that file? and then pkg_create -f foo and the package is made recursively from that dir?

Or does desc have to be made? of course if it was to go into ports it would have to written.

hopefully i have understood proberly..

maybe you could tell me about the programs that generate the files into a file, as typing 1000 filenames would be tedious.


thanks
 
Old 07-24-2006, 01:17 PM   #4
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Well, let's assume the program installs into /usr/local by default (or you set it to install there). This works for any prefix (even /tmp/foo) just change the parts where I specify /usr/local

Code:
 # before installation
find /usr/local -print > /tmp/before
./gmake install
find /usr/local -print > /tmp/after
cat /tmp/before /tmp/after | sort | uniq -u | sed 's/\/usr\/local\///' > /tmp/files
I know it looks like a lot (but it's actually not bad) and it lets you install the program right into the place on the system you want without specifying an empty prefix (like /tmp/foo). I actually use this to generate the list of files for programs I maintain just to ensure I don't miss anything.

If you want to use an empty prefix... you can just do:
Code:
./gmake install
find /tmp/foo -print | sed 's/\/tmp\/foo\///' > /tmp/files
But I am not sure this won't complicate things as you will need a different prefix for the package process than you wish to use for the installation on a system. But you should never have to type all those filenames into a file... there are tools to help you generate all that (which is why the command line is so vital to unix-like systems).

Note: in the sed command you need to escape .'s and /'s... if they appear in the path you are trying to remove. Which is why I have "\/usr\/local\/" and not "/usr/local/" in the above. Also, if the system is multi-user and you're not the only person doing things on it... you should visually check the generated file to ensure that all the files listed make sense. That way if someone else created a file under /usr/local after your first find but before the second, you're not going to include it as part of the package.

The description information can be anything you want. Anything at all... but it is needed for pkg_info to properly report the package when it's installed on your system. You can have:

Short:
Code:
Don't touch this package!
Long:
Code:
Leave me alone!
It doesn't really matter what they say, since they're for your system... but you should have something there.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating DSL Packages... cowboy_jake DamnSmallLinux 1 07-15-2005 09:08 PM
Creating static packages? Megamieuwsel Linux - Software 2 04-30-2004 02:17 AM
Creating packages... slackMeUp Slackware 9 02-09-2004 08:41 AM
creating slackware packages supenguin Slackware 1 10-20-2003 03:10 AM
creating packages (.tgz/.deb/.rpm) How from the source packages? l_9_l Linux - General 1 03-06-2002 06:03 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 04:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration