1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Add package porting infomation

This commit is contained in:
Martin Lenders 2013-11-18 12:30:01 +01:00
parent f8c8bc8ee6
commit cbd3b16fe4
4 changed files with 93 additions and 0 deletions

36
pkg/Makefile.git Normal file
View File

@ -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
pkg/Makefile.http Normal file
View File

@ -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
pkg/PORTING Normal file
View File

@ -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
pkg/USING Normal file
View File

@ -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>