# How can I force make to recompile a port?



## Snurg (Aug 21, 2016)

I want to make some modifications on software in a port.

I downloaded the source using "make extract". After that the files were present in the "work" subdirectory. I modified a file and then compiled using "make config", following "make" and finally "make install".

After testing I made further changes to that source file. However when attempting to compile the software again, make does not recognize that the software has to be rebuilt due to the changed file. 

What must I do to have make do its work of recompiling the modified software?


----------



## talsamon (Aug 21, 2016)

I am not sure if I understand you right.
After you run `make` or `make install`, you have to run `make clean`. You can't recompile, before you run this.. But this will also clean the changes in the source. So you have either save the changed files and copy it back, or make patches and copy (I use ports-mgmt/genpatch to make patches) it in the port in the directory named files. The patches have named like e.g patch-source_c. (It must beginn with "patch-") Be sure you have the correct path in the patch file.
Don't forget to save the patches, it will be overwritten at next update of this port.

https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/slow-patch.html


----------



## Snurg (Aug 21, 2016)

Thank you talsamon! 
You have understood me correctly! I just wanted to avoid the hassle of copying back the changed files etc.
The slow-patch description you directed me to is very helpful, as how-to-port-applications is on my To-Learn list...

It instructed me to do "make makepatch". This worked as it should, generating the appropriate patch file (e.g. 
patch-browser_components_sessionstore_SessionStore.jsm)
After "make clean" the "make" fails to build, however:


```
/usr/ports/www/firefox # make
===>  Found saved configuration for firefox-47.0.1_2,1
===>  firefox-47.0.1_2,1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by firefox-47.0.1_2,1 for building
===>  Extracting for firefox-47.0.1_2,1
=> SHA256 Checksum OK for firefox-47.0.1.source.tar.xz.
===>  Patching for firefox-47.0.1_2,1
===>  Applying FreeBSD patches for firefox-47.0.1_2,1
3 out of 6 hunks failed--saving rejects to media/libcubeb/src/cubeb_alsa.c.rej
=> Patch patch-bug1021761 failed to apply cleanly.
=> Patch(es) patch-browser-app-nsBrowserApp.cpp patch-browser_components_sessionstore_SessionStore.jsm patch-bug1013882 applied cleanly.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/firefox
*** Error code 1

Stop.
make: stopped in /usr/ports/www/firefox
/usr/ports/www/firefox # ll work/
total 14
-rw-r--r--  1 root  wheel  0 Aug 21 18:21 .extract_done.firefox._usr_local
drwxr-xr-x  52 root  wheel  85 Aug 21 18:21 firefox-47.0.1/
-rw-r--r--  1 root  wheel  6545 Aug 21 18:21 firefox.desktop
/usr/ports/www/firefox #
```

I guess the port got updated from v 47.0.1 to 47.0.1_2 while I was working on the file SessionStore.jsm, breaking the old version's patchfile "patch-bug1021761"?
Now I've got another problem to fix...


----------



## talsamon (Aug 21, 2016)

Patch-bug1021761 is a patch of the  files
configure.in ,
media/libcubeb/src/cubeb.c,
media/libcubeb/AUTHORS,
media/libcubeb/src/cubeb_alsa.c,
media/libcubeb/src/cubeb_oss.c,
media/webrtc/signaling/test/common.build,
media/webrtc/signaling/test/common.build and
media/libcubeb/src/moz.build .

If you also patched one of these files, maybe it could "interfere" with your patch (cause the line numbers or the code is not more the same as in the original patch).
You can see in media/libcubeb/src/cubeb_alsa.c.rej which part of the patch is going wrong.


----------



## talsamon (Aug 21, 2016)

I forgot:
You have also look in the Makefile, commands like this also changes files:

```
post-patch:
  @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
  ${WRKSRC}/browser/app/nsBrowserApp.cpp
```


----------



## talsamon (Aug 21, 2016)

I would be interesting what you have changed.
Consider; In a update cycle of six weeks, you have always renew the patch(es). Maybe, there is another way, to do what you want.

Btw, the next update may come in one of the next days, and seems to have some changes. I would wait some days;
PR 211792


----------



## Snurg (Aug 21, 2016)

Thank you very much talsamon for looking into this thing  

I modified only one file (browser/components/sessionstore/SessionStore.jsm), resulting in creation of the patch file "patch-browser_components_sessionstore_SessionStore.jsm" by "make makepatch".

The changes affect only a few lines which are responsible for incorrect placement of restored session windows on virtual screens, which is especially annoying in window managers like FVWM.
Thus I didn't understand what caused the error.

Now I will look into the possibilities you hinted at. If this does not reveal possible causes, I guess I'll try to delete the port and reinstall it from scratch, and then apply the changes again. I'll post the result.
Thank you very much again!


----------



## talsamon (Aug 21, 2016)

If the patch work, would you please post the patch. I am also working with fvwm-crystal. I know the problem with the window placement (but I never looked in this).


----------

