OpenWrt Forum Archive

Topic: Package Makefile for local sources

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi. Most of the Makefile examples I saw are downloading the sources from a remote recource like github. See PKG_SOURCE_URL:= section.

SNIPPED
  PKG_SOURCE_PROTO:=git
  PKG_SOURCE_URL:=git://github.com/antirez/dump1090.git
  PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  PKG_SOURCE_VERSION:=13596ba3ddfc41e77da7e42e8d9e76a984acede3
  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
SNIPPED

This works. I can make a dump1090 bin in an OpenWRT SDK environment (AA).

But howto customize the Makefile that using a local place for a UNPACKED/UNCOMPRESSED source code? Let us assume that the local path for the source code is

~/username/coding/dump1090

My idea is to "git clone" a repo. Than do any changes on the code in local place. Then "make package/dump1090/compile" without downloading source any time.

Thank you in advance for helping my out.... And excuse me for my bad writing in english language!

(Last edited by DE8MSH on 22 Oct 2013, 09:17)

In make menuconfig, enable "Advanced configuration options (for developers)" and in its submenu enable "Enable package source tree override".

Then clone your repo somewhere on your disk and symlink its .git subdirectory to the openwrt package as "git-src".

Example:

cd ~/coding
git clone git://github.com/antirez/dump1090.git
cd ~/coding/openwrt
ln -s ~/coding/dump1090/.git package/dump1090/git-src  (assuming "package/dump1090/" is the directory in the OpenWrt tree holding the Makefile)

Afterwards build with "make package/dump1090/{clean,compile}" as usual.
As long as the git-src symlink exists, OpenWrt will ignore the upstream location defined in the Makefile and use the repo pointed to by git-src, so you can make unpushed commits in your local clone, ammend or reset them etc. and recompile the package after each change without having to alter the Makefile.

To disable the mechanism again, either disable the source tree override in menuconfig or move the git-src symlink away (I usually rename it to "git-src_" so I can restore it easily later)

Jow,

That's cool. Thank you.

The discussion might have continued from here.