# Edit Makefile with a patch?



## Anonymous (Jul 9, 2013)

Hi guys,

I'm slowly learning how to switch from GNU/Linux to FreeBSD. For now, I'm only trying it in the WM. I think it's a good start. I plan to modify some ports for my personal needs.

Anyway, I would like to have some help about modifying ports options (especially `./configure`). Assuming, I want to "customize" x11/rxvt-unicode, with the following options:

```
./configure \
    --prefix=/usr \
    --with-terminfo=/usr/share/terminfo \
    --enable-256-color \
    --enable-combining \
    --enable-fading \
    --enable-font-styles \
    --enable-iso14755 \
    --enable-keepscrolling \
    --enable-lastlog \
    --enable-mousewheel \
    --enable-next-scroll \
    --enable-perl \
    --enable-pointer-blank \
    --enable-rxvt-scroll \
    --enable-selectionscrolling \
    --enable-slipwheeling \
    --enable-smart-resize \
    --enable-unicode3 \
    --enable-utmp \
    --enable-wtmp \
    --enable-xim \
    --enable-xterm-scroll \
    --disable-frills \
    --disable-pixbuf \
    --disable-startup-notification \
    --disable-transparency \
    --disable-xft
```
Should I remove all unneeded lines in the Makefile, or it's better to create a patch which will modify it? Actually, I don't really need all options required by dialog, can I remove similar lines?

```
.if !${PORT_OPTIONS:MSMART_RESIZE}
CONFIGURE_ARGS+=        --disable-smart-resize
.else
CONFIGURE_ARGS+=        --enable-smart-resize
.endif
```
I want to use only the first CONFIGURE_ARGS= (as OpenBSD ports for example). Any ideas?


----------



## ShelLuser (Jul 10, 2013)

Ypnose said:
			
		

> I'm slowly learning how to switch from GNU/Linux to FreeBSD. For now, I'm only trying it in the WM. I think it's a good start. I plan to modify some ports for my personal needs.
> 
> Anyway, I would like to have some help about modifying ports options (especially `./configure`). Assuming, I want to "customize" x11/rxvt-unicode, with the following options:
> 
> ...


Uhm, if you're on FreeBSD then you most definitely do not want to install a port into /usr. That is a bad idea(TM). Actually that's a _very_ bad idea.

On FreeBSD there is a strict separation between the base system (the main operating system if you will) and the collection of 3rd party software, or the ports collection. The base system sits, well, in the base whereas your ports reside in /usr/local.

As to the rest of your question: why do you think that you need to modify the Makefile in the first place?

If you need to configure a port then start by running `# make config`.

In this particular example; all you'd need to do to enable --enable-256-color is to select the right option (after running `# make config` of course):


```
[ ] 256_COLOR        Support for 256 colors
  [x] BACKSPACE_KEY    Handling of the backspace key by rxvt
  [x] COMBINING        Automatic composition of combining chars
  [x] DELETE_KEY       Handling of the delete key by rxvt
  [x] GDK_PIXBUF       Use gdk-pixbuf for background images
  [x] IMLOCALE_FIX     imlocale encoding conversion fix
```
I strongly suggest to take a closer look at chapter 5.6 of the FreeBSD handbook, this explains the basic principles on how to install and maintain your ports collection.

Including questions like yours on how one could configure a port to your own needs.


----------



## wblock@ (Jul 10, 2013)

Is this a modification to the port, or customizations in the system /etc/make.conf?

Adding new configuration options to a port is usually not too bad. Then those modifications can be submitted as a PR so everybody gets them.


----------



## Anonymous (Jul 10, 2013)

@ShelLuser: Yes, you're right about /usr. It's just the habits from the Linux world, so you can avoid this line  But for example, I want to disable Xft. This option isn't editable with `# make config`. I will probably need to add a similar section

```
.if !${PORT_OPTIONS:MXFT}
CONFIGURE_ARGS+=        --disable-xft
.else
CONFIGURE_ARGS+=        --enable-xft
.endif
```
This example works with others options as well (transparency, frills, etc). I will add many changes to the port, for sure.

@wblock@: No, this a modification to a port. For now, I'm not enough good to modify /etc/make.conf. I could do some port modifications, but I don't know if the maintainer will accept them.


----------



## wblock@ (Jul 10, 2013)

Yes, that is the right way to do it, but use positive logic:

```
.if ${PORT_OPTIONS:MXFT}
CONFIGURE_ARGS+=        --enable-xft
.else
CONFIGURE_ARGS+=        --disable-xft
.endif
```

Submit a well-tested patch in a PR to get the maintainer to accept it.


----------

