# Port makefile: Use local copy of upstream source



## jbo (Jul 28, 2022)

While developing the devel/qschematic port I had to perform some debugging on the upstream build system. At first, I created a separate branch in the upstream repository and used that branch in the port Makefile. However, I quickly determined that this is not a sustainable workflow so I started looking for better solutions.

My goal was to use a local copy of the upstream source rather than having the port Makefile fetching a modified version each time. As it turns out, this can be achieved easily by using a custom `do-extract` step in the port Makefile:

```
do-extract:
    ${MKDIR} ${WRKSRC};
    cp -r ./qschematic/* ${WRKSRC}
```
In the `do-extract` step we're first creating the ${WRKSRC} directory and then copy the upstream source from a local directory (in the example above from ./qscheamtic).

This allows modifying upstream code and running builds/tests without having to commit & push changes to a remote repository.
The nifty part here is that we don't have to worry about checkums passing because the ports framework is still fetching the source from upstream and performs the checkum checks on the fetched content. We just don't extract the fetched source but copy our local copy afterwards.

I've also posted this information on my blog: https://blog.insane.engineer/post/freebsd_simple_hosting


----------



## eternal_noob (Jul 28, 2022)

Nice blog, but you might want to fix that nasty 404.



			https://blog.insane.engineer/about
		


Quick links -> About


----------



## jbo (Jul 28, 2022)

eternal_noob said:


> Nice blog, but you might want to fix that nasty 404.


Fixed.
Good catch - thanks!


----------

