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

pkg: store packages sources in a global package directory #14289

Merged
merged 9 commits into from
Jun 26, 2020
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ clean:
@echo "Cleaning all build products for the current board"
@for dir in $(APPLICATION_DIRS); do "$(MAKE)" -C$$dir clean; done

distclean: docclean
pkg-clean:
@echo "Cleaning all package sources"
rm -rf build/pkg

distclean: docclean pkg-clean
@echo "Cleaning all build products"
@for dir in $(APPLICATION_DIRS); do "$(MAKE)" -C$$dir distclean; done

Expand Down
2 changes: 1 addition & 1 deletion Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BUILD_DIR ?= $(RIOTBASE)/build
APPDIR ?= $(CURDIR)
BINDIRBASE ?= $(APPDIR)/bin
BINDIR ?= $(BINDIRBASE)/$(BOARD)
PKGDIRBASE ?= $(BINDIRBASE)/pkg/$(BOARD)
PKGDIRBASE ?= $(RIOTBASE)/build/pkg
DLCACHE ?= $(RIOTTOOLS)/dlcache/dlcache.sh
DLCACHE_DIR ?= $(RIOTBASE)/.dlcache

Expand Down
8 changes: 5 additions & 3 deletions dist/tools/bossa-1.8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ PKG_NAME = bossa
PKG_URL = https://github.com/shumatech/BOSSA
PKG_VERSION = 26154375695f345491bba158d57177aa231d6765
PKG_LICENSE = BSD-3-Clause
PKG_BUILDDIR = $(CURDIR)/bin

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0

include $(RIOTBASE)/pkg/pkg.mk

all:
@echo "[INFO] compiling bossac from source now"
@env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_BUILDDIR) strip-bossac
@mv $(PKG_BUILDDIR)/bossac $(CURDIR)/bossac
@env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILD_DIR) -C $(PKG_BUILD_DIR) strip-bossac
@mv $(PKG_BUILD_DIR)/bossac $(CURDIR)/bossac

distclean::
@rm -f $(CURDIR)/bossac
8 changes: 5 additions & 3 deletions dist/tools/bossa-1.9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ PKG_NAME = bossa
PKG_URL = https://github.com/shumatech/BOSSA
PKG_VERSION = 1.9.1
PKG_LICENSE = BSD-3-Clause
PKG_BUILDDIR = $(CURDIR)/bin

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0

include $(RIOTBASE)/pkg/pkg.mk

all:
@echo "[INFO] compiling bossac from source now"
@env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_BUILDDIR) strip-bossac
@mv $(PKG_BUILDDIR)/bossac $(CURDIR)/bossac
@env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILD_DIR) -C $(PKG_BUILD_DIR) strip-bossac
@mv $(PKG_BUILD_DIR)/bossac $(CURDIR)/bossac

distclean::
@rm -f $(CURDIR)/bossac
8 changes: 5 additions & 3 deletions dist/tools/bossa-nrf52/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ PKG_NAME = bossa
PKG_URL = https://github.com/arduino/BOSSA
PKG_VERSION = 52e0a4a28721296e64083de7780b30580e0fad16
PKG_LICENSE = BSD-3-Clause
PKG_BUILDDIR = $(CURDIR)/bin

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0

include $(RIOTBASE)/pkg/pkg.mk

all:
@echo "[INFO] compiling bossac from source now"
@env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_BUILDDIR) strip-bossac
@mv $(PKG_BUILDDIR)/bossac $(CURDIR)/bossac
@env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILD_DIR) -C $(PKG_BUILD_DIR) strip-bossac
@mv $(PKG_BUILD_DIR)/bossac $(CURDIR)/bossac

distclean::
@rm -f $(CURDIR)/bossac
2 changes: 1 addition & 1 deletion dist/tools/cc2538-bsl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ PKG_BUILDDIR=$(CURDIR)/bin
include $(RIOTBASE)/pkg/pkg.mk

all:
cp $(PKG_BUILDDIR)/cc2538-bsl.py .
cp $(PKG_SOURCE_DIR)/cc2538-bsl.py .
8 changes: 5 additions & 3 deletions dist/tools/edbg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ PKG_NAME=edbg
PKG_URL=https://github.com/ataradov/edbg
PKG_VERSION=99d15460fcff723f73b16c29c8ca14bff4b33b20
PKG_LICENSE=BSD-3-Clause
PKG_BUILDDIR=$(CURDIR)/bin

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0

include $(RIOTBASE)/pkg/pkg.mk

all:
# Start edbg build in a clean environment, so variables set by RIOT's build process
# for cross compiling a specific target platform are reset and edbg can
# be built cleanly for the native platform.
env -i PATH="$(PATH)" TERM="$(TERM)" "$(MAKE)" -C "$(PKG_BUILDDIR)"
mv $(PKG_BUILDDIR)/edbg .
env -i PATH="$(PATH)" TERM="$(TERM)" "$(MAKE)" -C "$(PKG_BUILD_DIR)"
mv $(PKG_BUILD_DIR)/edbg .
2 changes: 1 addition & 1 deletion dist/tools/flatc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
flatc
bin
bin/
15 changes: 6 additions & 9 deletions dist/tools/flatc/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
PKG_NAME=flatc
PKG_NAME=flatbuffers
PKG_URL=https://github.com/google/flatbuffers
PKG_VERSION=9e7e8cbe9f675123dd41b7c62868acad39188cae
PKG_LICENSE=Apache2.0

PKG_BUILDDIR=$(CURDIR)/bin

FLATC_SOURCE_DIR = $(PKG_BUILDDIR)
FLATC_BUILD_DIR = $(PKG_BUILDDIR)/build

# manually set some RIOT env vars, so this Makefile can be called stand-alone
RIOTBASE ?= $(CURDIR)/../../..
RIOTTOOLS ?= $(CURDIR)/..
PKGDIRBASE ?= $(RIOTBASE)/build/pkg
PKG_BUILD_DIR ?= $(CURDIR)/bin

CMAKE_OPTIONS = \
-DCMAKE_BUILD_TYPE=Release \
Expand All @@ -26,9 +23,9 @@ endif
include $(RIOTBASE)/pkg/pkg.mk

all:
@env -i PATH="$(PATH)" cmake -G "Unix Makefiles" $(CMAKE_OPTIONS) -H"$(FLATC_SOURCE_DIR)" -B"$(FLATC_BUILD_DIR)"
"$(MAKE)" -C "$(FLATC_BUILD_DIR)"
@mv "$(FLATC_BUILD_DIR)"/flatc $(CURDIR)/flatc
@env -i PATH="$(PATH)" cmake -G "Unix Makefiles" $(CMAKE_OPTIONS) -H"$(PKG_SOURCE_DIR)" -B"$(PKG_BUILD_DIR)"
"$(MAKE)" -C "$(PKG_BUILD_DIR)"
@mv "$(PKG_BUILD_DIR)"/flatc $(CURDIR)/flatc

distclean::
@rm -f $(CURDIR)/flatc
7 changes: 3 additions & 4 deletions dist/tools/kconfiglib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ PKG_NAME=kconfiglib
PKG_URL=https://github.com/ulfalizer/Kconfiglib
PKG_VERSION=82f59179b1b35fcd8b6d188453b283599ea70518
PKG_LICENSE=ISC
PKG_BUILDDIR=$(CURDIR)/bin

include $(RIOTBASE)/pkg/pkg.mk

all:
$(Q)cp $(PKG_BUILDDIR)/kconfiglib.py $(PKG_BUILDDIR)/menuconfig.py \
$(PKG_BUILDDIR)/genconfig.py $(PKG_BUILDDIR)/examples/merge_config.py \
$(Q)cp $(PKG_SOURCE_DIR)/kconfiglib.py $(PKG_SOURCE_DIR)/menuconfig.py \
$(PKG_SOURCE_DIR)/genconfig.py $(PKG_SOURCE_DIR)/examples/merge_config.py \
.

remove:
$(Q)$(RM) -r $(PKG_BUILDDIR) kconfiglib.py menuconfig.py genconfig.py \
$(Q)$(RM) -r $(PKG_SOURCE_DIR) kconfiglib.py menuconfig.py genconfig.py \
merge_config.py
18 changes: 10 additions & 8 deletions dist/tools/mosquitto_rsmb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@ PKG_NAME = mosquitto_rsmb
PKG_URL = https://github.com/eclipse/mosquitto.rsmb
PKG_VERSION = 9b99a3be9a26635b93aec8fa2ed744e8c49e7262
PKG_LICENSE = EPL-1.0
PKG_BUILDDIR = $(CURDIR)/bin

# set default configuration file
RSMB_CFG ?= $(CURDIR)/config.cnf

# manually set some RIOT env vars, so this Makefile can be called stand-alone
RIOTBASE ?= $(CURDIR)/../../..
RIOTTOOLS ?= $(CURDIR)/..

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0

# Include pkg.mk after setting RIOTBASE otherwise it is not found when this
# Makefile is called stand-alone
include $(RIOTBASE)/pkg/pkg.mk

# set default configuration file
RSMB_CFG ?= $(CURDIR)/config.cnf

all:
# Start mosquitto_rsmb build in a clean environment, so variables set by RIOT's
# build process for cross compiling a specific target platform are reset and
# mosquitto_rsmb can be built cleanly for the host platform.
env -i PATH=$(PATH) TERM=$(TERM) "$(MAKE)" -C $(PKG_BUILDDIR)/rsmb/src
cp $(PKG_BUILDDIR)/rsmb/src/broker_mqtts $(CURDIR)/mosquitto_rsmb
cp $(PKG_BUILDDIR)/rsmb/src/Messages.1.* $(CURDIR)/
env -i PATH=$(PATH) TERM=$(TERM) "$(MAKE)" -C $(PKG_BUILD_DIR)/rsmb/src
cp $(PKG_BUILD_DIR)/rsmb/src/broker_mqtts $(CURDIR)/mosquitto_rsmb
cp $(PKG_BUILD_DIR)/rsmb/src/Messages.1.* $(CURDIR)/

run:
@$(CURDIR)/mosquitto_rsmb $(RSMB_CFG)

clean::
@rm -rf $(CURDIR)/bin
@rm -rf $(PKG_BUILD_DIR)
@rm -f $(CURDIR)/mosquitto_rsmb
@rm -f $(CURDIR)/Messages.1.*
@rm -f $(CURDIR)/FFDC.CWNAN.*.dmp
6 changes: 4 additions & 2 deletions dist/tools/pic32prog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ PKG_VERSION = b9f8db3b352804392b02b42475fc42874ac8bf04
PKG_LICENSE = GPL-2
PKG_BUILDDIR = bin

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0
include $(RIOTBASE)/pkg/pkg.mk

# Building it requires some dependencies, on ubuntu:
Expand All @@ -12,8 +14,8 @@ include $(RIOTBASE)/pkg/pkg.mk

all:
@echo "[INFO] compiling pic32prog from source now"
@env -i PATH=$(PATH) TERM=$(TERM) make -C $(PKG_BUILDDIR)
@mv $(PKG_BUILDDIR)/pic32prog pic32prog
@env -i PATH=$(PATH) TERM=$(TERM) make -C $(PKG_BUILD_DIR)
@mv $(PKG_BUILD_DIR)/pic32prog pic32prog

distclean::
@rm -f pic32prog
6 changes: 4 additions & 2 deletions dist/tools/setsid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ PKG_VERSION = e5b851df41591021baf5cf88d4e41572baf8e08b
PKG_LICENSE = BSD-2-Clause
PKG_BUILDDIR = $(CURDIR)/bin

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0
include $(RIOTBASE)/pkg/pkg.mk

all:
@echo "[INFO] compiling setsid from source now"
$(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_BUILDDIR)
@mv $(PKG_BUILDDIR)/setsid $(CURDIR)/setsid
$(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_SOURCE_DIR)
@mv $(PKG_SOURCE_DIR)/setsid $(CURDIR)/setsid

distclean::
@rm -f $(CURDIR)/setsid
7 changes: 4 additions & 3 deletions dist/tools/teensy-loader-cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PKG_NAME=teensy-loader-cli
PKG_LICENSE=GPL-3
PKG_BUILDDIR=$(CURDIR)/bin

# get sources from repository
ifeq ($(OS),Darwin)
Expand All @@ -12,8 +11,10 @@ else
PKG_VERSION=76921edbdd81ae99b869b104404c16c06b0a266f
endif

PKG_SOURCE_DIR = $(CURDIR)/bin
PKG_BUILD_OUT_OF_SOURCE = 0
include $(RIOTBASE)/pkg/pkg.mk

all:
env -i PATH=$(PATH) TERM=$(TERM) "$(MAKE)" -C $(PKG_BUILDDIR)
mv $(PKG_BUILDDIR)/teensy_loader_cli ./teensy_loader
env -i PATH=$(PATH) TERM=$(TERM) "$(MAKE)" -C $(PKG_SOURCE_DIR)
mv $(PKG_SOURCE_DIR)/teensy_loader_cli ./teensy_loader
2 changes: 1 addition & 1 deletion pkg/Makefile.git
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PKG_LICENSE= # license of the package
include $(RIOTBASE)/pkg/pkg.mk

all:
$(MAKE) -C $(CURDIR)/$(PKG_NAME)
$(MAKE) -C $(PKG_SOURCE_DIR) -f $(RIOTBASE)/Makefile.base
14 changes: 7 additions & 7 deletions pkg/c25519/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PKG_EXT = zip
PKG_LICENSE = PD
PKG_SHA512 = dbfb4285837ab2ea3d99c448b22877cc7a139ccbaebb1de367e2bec1fd562fe629b389d86603915448078b8fd7e631c8fc9a7d126eb889a1ba0c17611369b190

PKG_BUILDDIR ?= $(PKGDIRBASE)/$(PKG_NAME)
PKG_SOURCE_DIR ?= $(PKGDIRBASE)/$(PKG_NAME)
PKG_ZIPFILE = $(PKGDIRBASE)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)

ifneq ($(RIOTBASE),)
Expand All @@ -14,12 +14,12 @@ endif

.PHONY: all clean distclean

prepare: $(PKG_BUILDDIR)/
prepare: $(PKG_SOURCE_DIR)/

all: $(PKG_BUILDDIR)/
"$(MAKE)" -C $(PKG_BUILDDIR)/src -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_NAME)
all: $(PKG_SOURCE_DIR)/
"$(MAKE)" -C $(PKG_SOURCE_DIR)/src -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_NAME)

$(PKG_BUILDDIR)/: $(PKGDIRBASE)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
$(PKG_SOURCE_DIR)/: $(PKGDIRBASE)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
test "$(PKG_SHA512) $(PKG_ZIPFILE)" = "$$(sha512sum "${PKG_ZIPFILE}")"
$(Q)$(UNZIP_HERE) -D -d $(PKGDIRBASE) $<

Expand All @@ -29,7 +29,7 @@ $(PKG_ZIPFILE):

clean::
# Reset package to checkout state.
rm -rf $(PKG_BUILDDIR)
rm -rf $(PKG_SOURCE_DIR)

distclean::
rm -rf $(PKG_BUILDDIR) $(PKGDIRBASE)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
rm -rf $(PKG_SOURCE_DIR) $(PKGDIRBASE)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
2 changes: 1 addition & 1 deletion pkg/cayenne-lpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PKG_LICENSE=LGPLv2.1
include $(RIOTBASE)/pkg/pkg.mk

all:
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(RIOTBASE)/Makefile.base
"$(MAKE)" -C $(PKG_SOURCE_DIR) -f $(RIOTBASE)/Makefile.base
15 changes: 6 additions & 9 deletions pkg/ccn-lite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ include $(RIOTBASE)/pkg/pkg.mk

.PHONY: ..cmake_version_supported

CCNLITE_SOURCE_DIR = $(PKG_BUILDDIR)
CCNLITE_BUILD_DIR = $(PKG_BUILDDIR)/build

CMAKE_MINIMAL_VERSION = 3.6.0

RIOT_CFLAGS = $(INCLUDES)
Expand All @@ -18,18 +15,18 @@ ifeq (llvm,$(TOOLCHAIN))
RIOT_CFLAGS += -Wno-char-subscripts
endif

TOOLCHAIN_FILE = $(CCNLITE_SOURCE_DIR)/xcompile-toolchain.cmake
TOOLCHAIN_FILE = $(PKG_SOURCE_DIR)/xcompile-toolchain.cmake

all: $(BINDIR)/ccn-lite.a

$(BINDIR)/ccn-lite.a: $(CCNLITE_BUILD_DIR)/lib/libccnl-riot.a
$(BINDIR)/ccn-lite.a: $(PKG_BUILD_DIR)/lib/libccnl-riot.a
cp $< $@

$(CCNLITE_BUILD_DIR)/lib/libccnl-riot.a: $(CCNLITE_BUILD_DIR)/Makefile
$(MAKE) -C $(CCNLITE_BUILD_DIR)
$(PKG_BUILD_DIR)/lib/libccnl-riot.a: $(PKG_BUILD_DIR)/Makefile
$(MAKE) -C $(PKG_BUILD_DIR)

$(CCNLITE_BUILD_DIR)/Makefile: $(PKG_PREPARED) $(TOOLCHAIN_FILE) | ..cmake_version_supported
cmake -B$(CCNLITE_BUILD_DIR) -H$(CCNLITE_SOURCE_DIR)/src \
$(PKG_BUILD_DIR)/Makefile: $(PKG_PREPARED) $(TOOLCHAIN_FILE) | ..cmake_version_supported
cmake -B$(PKG_BUILD_DIR) -H$(PKG_SOURCE_DIR)/src \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCCNL_RIOT=1 -DRIOT_CFLAGS="$(RIOT_CFLAGS)" -DBUILD_TESTING=OFF

Expand Down
2 changes: 1 addition & 1 deletion pkg/cifra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PKG_LICENSE=CC-0
include $(RIOTBASE)/pkg/pkg.mk

all:
"$(MAKE)" -C $(PKG_BUILDDIR)/src -f $(CURDIR)/Makefile.cifra
"$(MAKE)" -C $(PKG_SOURCE_DIR)/src -f $(CURDIR)/Makefile.cifra
2 changes: 1 addition & 1 deletion pkg/cmsis-dsp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ include $(RIOTBASE)/pkg/pkg.mk
CFLAGS += -Wno-strict-aliasing -Wno-unused-parameter

all:
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.$(PKG_NAME) all
"$(MAKE)" -C $(PKG_SOURCE_DIR) -f $(CURDIR)/Makefile.$(PKG_NAME) all
2 changes: 1 addition & 1 deletion pkg/cmsis-nn/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ CFLAGS += -Wno-strict-aliasing -Wno-unused-parameter
include $(RIOTBASE)/pkg/pkg.mk

all:
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.$(PKG_NAME)
"$(MAKE)" -C $(PKG_SOURCE_DIR) -f $(CURDIR)/Makefile.$(PKG_NAME)
2 changes: 1 addition & 1 deletion pkg/cn-cbor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include $(RIOTBASE)/pkg/pkg.mk
CFLAGS += -DCBOR_ALIGN_READS

all:
"$(MAKE)" -C $(PKG_BUILDDIR)/src -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_NAME)
"$(MAKE)" -C $(PKG_SOURCE_DIR)/src -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_NAME)
Loading