Editing the the sources of a port before installation

Installing and maintaining the FreeBSD Ports Collection or FreeBSD Packages (i.e. third party software).

Editing the the sources of a port before installation

Postby Michael-Sanders » 01 Feb 2012, 21:49

Question: What is the preferred method of modifying the sources of a given third party package before its installed? Allow me to clarify.

After installing Midnight Commander: [cmd=]sudo pkg_add -r mc[/cmd]

I found the package suffered from an ftp issue I sought to fix. I next removed [FILE]mc[/FILE], installed its port sources and after some wrestling with [FILE]make[/FILE] patched the sources and installed the modified version successfully.

(Please bear with me here, I'm new to FreeBSD and am attempting to describe the problem using proper nomenclature).

If one needs to edit the sources of a port, yet one can only invoke [FILE]make[/FILE] (that I'm currently aware of) to start the build process, how is it possible to first edit, then build a port's sources?

If my case to solve this, I invoked [FILE]make[/FILE] followed by CTRL-C to disrupt the build process, edited the necessary file, then ran [FILE]make[/FILE] again. But I'm thinking I've approached things the hard way when a better, more streamlined solution likely exists.
Junior Member
Posts: 41
Joined: 01 Feb 2012, 16:26

Postby DutchDaemon » 01 Feb 2012, 21:57

See the [FILE]TARGETS[/FILE] in [man=7]ports[/man]. There's much more you can do with [file]make[/file] other than starting the build.
User avatar
Old Fart
Posts: 10463
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby Michael-Sanders » 01 Feb 2012, 22:08

Yes, I see now under section TARGETS of ports(7): fetch & extract apply (thank you DutchDaemon).

I'll study this now.
Junior Member
Posts: 41
Joined: 01 Feb 2012, 16:26

Postby phoenix » 01 Feb 2012, 22:08

Have a gander through the Porter's Handbook, as well. Especially the section on Patching Sources. :)

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
User avatar
Posts: 3349
Joined: 17 Nov 2008, 05:43
Location: Kamloops, BC, Canada

Postby SirDice » 02 Feb 2012, 07:50

You basically want to do these:
Code: Select all
make fetch     # fetches the distfile
make extract   # extracts the distfile into the work directory
make patch     # applies any specific FreeBSD patches
make configure # runs ./configure

After that you could edit the sources in the work directory. Once finished you can continue with the install.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
Old Fart
Posts: 16166
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby wblock@ » 02 Feb 2012, 14:58

But because this is [man=1]make[[/man], earlier steps are done automatically. In other words, [file]make patch[/file] is equivalent to [file]make fetch extract patch[/file].
User avatar
Old Fart
Posts: 10183
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Return to Installation and Maintenance of FreeBSD Ports or Packages

Who is online

Users browsing this forum: Bing [Bot], sergling and 0 guests