DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 30th September 2008
boincv boincv is offline
New User
 
Join Date: Sep 2008
Posts: 1
Default ports config and makefile scripting

Hi

I am trying out FreeBSD and don't know much scripting - I am trying to build some programs from the ports. Now in linux I could do something like

./configure --abcdef --ghijkl

then "make install", and the docs for various programs also tell me how to config in this way. What is the equivalent for FreeBSD ports? I have tried something like "make config" or "make showconfig" but it doesn't give the equivalent functionality or sometimes it just says "no options" evne though the program's site says there are.

Well I noticed that there is no configure script in the ports directories which is why ./configure doesn't work, but when building stuff I can see that it has extracted the script elsewhere and is running it. So how do I pass the options to that script?

I have also ventured into the makefile, for example this one

Code:
.if !defined(WITHOUT_NLS)
USE_ICONV=		yes
CONFIGURE_ENV=		CPPFLAGS="-I${LOCALBASE}/include" \
			LIBS="-L${LOCALBASE}/lib -liconv"
CONFIGURE_ARGS+=	--enable-nls
PLIST_SUB+=		NLS:=""
.else
CONFIGURE_ENV=		CPPFLAGS="-I${LOCALBASE}/include" \
			LIBS="-L${LOCALBASE}/lib"
CONFIGURE_ARGS+=	--disable-nls
PLIST_SUB+=		NLS:="@comment "
.endif

.if !defined(WITHOUT_REMEMBER)
CONFIGURE_ARGS+=	--enable-remember
.else
CONFIGURE_ARGS+=	--disable-remember
.endif

.if !defined(WITHOUT_SLIT)
CONFIGURE_ARGS+=	--enable-slit
.else
CONFIGURE_ARGS+=	--disable-slit
.endif
could someone please explain - how do I define the things like WITHOUT_SLIT and where is CONFIGURE_ARGS passed to, what is the best way to do what I want to do?

Thanks for all help.
Reply With Quote
  #2   (View Single Post)  
Old 30th September 2008
robbak's Avatar
robbak robbak is offline
Real Name: Robert Backhaus
VPN Cryptographer
 
Join Date: May 2008
Location: North Queensland, Australia
Posts: 366
Default

On most ports, you run # make && make install. The port will ask you what settings you want, and save your answers in a config file for next time (/var/db/ports/portname/config, I think)

Some ports have not been updated to use this system, and for them you will need to set the variables you have seen. The syntax is # make WITHOUT_FEATURE="yes" WITH_FEATURE="yes" USE_PROG_VERSION="2.3" install. You can also use the -D argument to make if you prefer. (make -DWITH_FEATURE )

There are a number of ways to automate things. Ports that use the config system automate themselves. for the others, there are a number of different options.
If you are using portupgrade to manage your ports, then it has a /usr/local/etc/pkgtools.conf file to automate things. The portsconf ports allows you to automatically set ports variables in it's config file. A very clever way is by slightly misusing /etc/make.conf - carpetsmoker at this forum has an example - to insert make variables depending on the port you are building.

Edit carpetsmoker's make.conf
__________________
The only dumb question is a question not asked.
The only dumb answer is an answer not given.

Last edited by robbak; 30th September 2008 at 11:44 PM.
Reply With Quote
  #3   (View Single Post)  
Old 30th September 2008
DutchDaemon's Avatar
DutchDaemon DutchDaemon is offline
Real Name: Ben
Spam Refugee
 
Join Date: Jul 2008
Location: Rotterdam, The Netherlands
Posts: 336
Default

Quote:
Originally Posted by robbak View Post
On most ports, you run # make && make instal.
Much more common:

# make install clean
Reply With Quote
  #4   (View Single Post)  
Old 1st October 2008
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 696
Default

When in doubt, read the man page. ports(7)

And the Handbook covers this in detail as well.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #5   (View Single Post)  
Old 1st October 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Generally you should stick to the options that ports provide, whether through the 'config' target or the -DWITH_FOO knobs that Robbak mentined. The CONFIGURE_ARGS variable should get passed onto ./configure when a port uses it, so # make CONFIGURE_ARGS+="--custom-args" would likely allow you to modify the configure arguments used for the port directly, if the port Makefile doesn't give you proper way of controlling he build options you need (for some odd reason). Generally there should be no need to manipulate the configure script directly.


When in doubt or curiosity about what something does in ports, open /usr/ports/Mk/ and start reading. Best way to find out, even compared to the manual!
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #6   (View Single Post)  
Old 1st October 2008
BSDKaffee's Avatar
BSDKaffee BSDKaffee is offline
Real Name: Jason Hale
Coffee Addict
 
Join Date: May 2008
Location: Wintersville, Ohio
Posts: 212
Default

Quote:
Originally Posted by TerryP View Post
The CONFIGURE_ARGS variable should get passed onto ./configure when a port uses it, so # make CONFIGURE_ARGS+="--custom-args" would likely allow you to modify the configure arguments used for the port directly, if the port Makefile doesn't give you proper way of controlling he build options you need (for some odd reason).
Note, that would override all CONFIGURE_ARGS set in the Makefile. The "+=" operator does not work on the commandline like it would in a Makefile.
Reply With Quote
  #7   (View Single Post)  
Old 1st October 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Thanks for pointing that out, I didn't realize that. But that does makes me very happy, that I don't manually adjust configure args...
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Good Bash/Scripting book? cwhitmore Programming 10 22nd December 2017 03:59 PM
Makefile Problem BadWolf Programming 4 15th March 2009 01:58 PM
Shell scripting resources J65nko Programming 0 23rd December 2008 09:57 PM
Shell Scripting with BSD chavez243 Programming 9 3rd December 2008 03:03 AM
Change Makefile options in ports shep FreeBSD Ports and Packages 5 18th August 2008 07:58 AM


All times are GMT. The time now is 10:27 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick