Makefile question... please help...

Koushik Narayanan koushikn at pubbox.net
Wed Dec 6 04:31:28 PST 2006


On Wed, Dec 06, 2006 at 12:38:49AM +0100, VeeJay wrote:
> Hi there,
> 
> Is it possible to make configuration changes in Makefile to install a port
> as per one's requirments?

It is possible. But it is better to avoid as it gets overwritten when you cvsup or portsnap.

> 
> I want to accomplish two tasks....
> 
> 1. I want to configure mysql port before installation with following
> parameters: Could someone tell me that where in the Makefile, I need to put
> these paramenters in order to get my required results? Makefile is at the
> end of my message.

For each of these options there are usually knobs to set at the command line. You can easily find out these knobs from the MakeFile.

If there are no knobs for a particular option then AFAIK you have to change the Makefile. CONFIGURE_ARGS is the variable that holds all arguments that will be passed. You can add to it as you requre.
  
> Required Configuration paramenters:
> 
> --prefix=/usr/local/mysql
> --with-mysqld-user=mysql
> --with-unix-socket-path=/tmp/mysql.sock

These three donot have any knobs AFAIK. So you have to change your Makefile.

> --with-mysqld-ldflags=-all-static

This one has a knob named BUILD_STATIC. So you could do make -DBUILD_STATIC install to add this configuration alone.

<snip>

> CONFIGURE_ARGS= --localstatedir=${DB_DIR} \
>                --without-debug \
>                --without-readline \
>                --without-libedit \
>                --without-bench \
>                --without-extra-tools \
>                --with-libwrap \
>                --with-mysqlfs \
>                --with-vio \
>                --with-low-memory \
>                --with-comment='FreeBSD port: ${PKGNAME}' \
>                --enable-thread-safe-client

This is the CONFIGURE_ARGS variable. Modify it as you like. Donot forget the '\'at the end of each non terminating line.

<snip>

> .if defined(BUILD_STATIC)
> CONFIGURE_ARGS+=--with-mysqld-ldflags=-all-static
> .endif

This is what I meant by a knob. If you pass -DBUILD_STATIC to make, this 'if' returns true and the extra option to CONFIGURE_ARGS is concatenated. You could also define BUILD_STATIC in your shell from which you run make. It has the same effect.

When you change your Makefile, make sure to rename it to so that it survives a cvsup.

HTH

Koushik Narayanan


More information about the freebsd-questions mailing list