Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package porting infomation #338

Merged
merged 1 commit into from Dec 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions pkg/Makefile.git
@@ -0,0 +1,36 @@
PKG_NAME= # name of the package
PKG_URL= # source url of the package e.g. a git repository
PKG_VERSION= # version of the package to use e.g. a git commit/ref

ifneq ($(RIOTBOARD),)
include $(RIOTBOARD)/Makefile.base
include $(RIOTBOARD)/$(BOARD)/Makefile.include
endif

.PHONY: all clean patch reset

all: patch
make -C $(CURDIR)/$(PKG_NAME)

patch: $(CURDIR)/$(PKG_NAME)/Makefile
# Dependancy might be changed accordingly though we think the Makefile
# will be the first thing you want to change
#
# Here might not happen anything besides dependancy checks

$(CURDIR)/$(PKG_NAME)/Makefile: $(CURDIR)/$(PKG_NAME)
# Here you apply your patch.
$(foreach patch,$(shell ls [0-9][0-9][0-9][0-9]*.patch),cd "$<" && git am "$(patch)";)

$(PKG_NAME)/:
# Get PKG_VERSION of package from PKG_URL
git clone $(PKG_URL) $(PKG_NAME) && cd $(PKG_NAME) && git checkout $(PKG_VERSION)

clean::
# Reset package to checkout state.
cd $(CURDIR)/$(PKG_NAME) || true && \
git clean -x -f && \
git reset --hard $(PKG_VERSION)

distclean::
rm -rf $(CURDIR)/$(PKG_NAME)
42 changes: 42 additions & 0 deletions pkg/Makefile.http
@@ -0,0 +1,42 @@
PKG_NAME= # name of the package
PKG_URL= # source url of the package e.g. a git repository
PKG_VERSION= # version of the package to use e.g. a git commit/ref
PKG_EXT= # extenison of this package

FETCH=$(shell which wget &> /dev/null && echo "wget" || echo "curl")
UNPACK=tar -xvf

ifneq ($(RIOTBOARD),)
include $(RIOTBOARD)/Makefile.base
include $(RIOTBOARD)/$(BOARD)/Makefile.include
endif

.PHONY: all clean patch reset

all: patch
make -C $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)

patch: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/Makefile
# Dependancy might be changed accordingly though we think the Makefile
# will be the first thing you want to change
#
# Here might not happen anything besides dependancy checks

$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/Makefile: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/
# Here you apply your patch.
cd $< && patch ../patch.txt

$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
$(UNPACK) $<

$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT):
# Get PKG_VERSION of package from PKG_URL
@$(FETCH) -O $@ $(PKG_URL)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT) || true

clean::
# Reset package to checkout state.
rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION) && \
make $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/Makefile

clean::
rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION) $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
10 changes: 10 additions & 0 deletions pkg/PORTING
@@ -0,0 +1,10 @@
This directory provides some porting information for libraries and programs to
use with RIOT (to build an external module). If you like add a package to RIOT
you need to add directory to this directory with the name of your package. This
directory should contain at least to files:
* patch.txt - Your patch of the upstream project of the package to make it
build with RIOT
* Makefile - A Makefile describing how to get the upstream project, apply
the patch and how to build the package as a RIOT module.
a rough template for several methods of aquiring a package
is provided in Makefile.git, Makefile.http, and Makefile.svn
5 changes: 5 additions & 0 deletions pkg/USING
@@ -0,0 +1,5 @@
Packages are included to your project as external modules. Thus you only have
to add the following line to your project (and update your INCLUDE path
accordingly):

EXTERNAL+=$(RIOTBASE)/pkg/<pkg_name>