13

I'm making an embedded Linux system and I wanted to add the 'bluez' package (and bluetooth utilities) to the packages of the Buildroot environment.

Unfortunately the tar ball seems to be unavailable but the source is available from Git repositiory but I'm not sure how I can include this in the .mk file.

Can I do this and if so how?

D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97

3 Answers3

22

Buildroot already has a bluez package, which will be part of the upcoming 2011.11 release. In the mean time, you can either use the latest Git version of Buildroot, or back-port the bluez package into an older version of Buildroot.

Coming back to the initial question, Buildroot is capable of fetching source code from Git repositories. As stated in the documentation, you simply need to do:

MYPKG_VERSION = some_commit_id_or_tag_or_branch_name
MYPKG_SITE = git://thegitrepository
MYPKG_SITE_METHOD = git

in your .mk file.

Thomas Petazzoni
  • 5,636
  • 17
  • 25
  • Thanks. I'm using a custom buildroot for Phidget devices so the 2011.11 release would need tweaking for Phidgets as well. Your answer has helped me though and I can combine this with ahe Buildroot Phidget have released. – D-Dᴙum Nov 05 '11 at 19:41
  • 1
    Method is now guessed from the `git://` prefix. – Ciro Santilli OurBigBook.com Jun 25 '17 at 08:51
  • for repos at github following macro can be used `FOO_SITE = $(call github,,,$(FOO_VERSION)` – Mixaz Jan 17 '20 at 15:24
  • Say i wanted to do git clones of multiple repo's in one package, is there a way to do that. Cant select more than one mypkg_site in one package? – John smith Oct 08 '20 at 13:32
2

Minimal working in-tree 2016.05 example

https://github.com/cirosantilli/buildroot/tree/git-package-2016.05

The only interesting file is package/hello/Config.in:

HELLO_VERSION = branch2
HELLO_SITE = git://github.com/cirosantilli/hello-c.git

define HELLO_BUILD_CMDS
    $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)
endef

define HELLO_INSTALL_TARGET_CMDS
        $(INSTALL) -D -m 0755 $(@D)/hello $(TARGET_DIR)/usr/bin
endef

$(eval $(generic-package))

It downloads and builds: https://github.com/cirosantilli/hello-c

MYPKG_SITE_METHOD = git is inferred from the git: on SITE.

git submodule + *_OVERRIDE_SRCDIR for git forks

If you are going to modify the source of the repository, I recommend this approach: How to modify the source of Buildroot packages for package development?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
1

It looks like there are tarballs of the bluez package already available. A Google search for "bluez" yields http://www.bluez.org/download/, which has links to several tarballs.

If for some reason you really want the code from the Git repository, you can make a local clone of the repository and then use the git archive command to create a tarball. See git archive --help for the documentation.

Depending on your needs, you may also be able to build directly from your local copy of the repository (rather than creating a tarball only to unpack it again in a later step).

larsks
  • 277,717
  • 41
  • 399
  • 399
  • The tar balls were not available when I tried but the git repository is. I am just not sure how to use the git repository in the .mk file but Thomas's answer and looking at the docs has helped – D-Dᴙum Nov 05 '11 at 19:39