From e0185faa785cbf3e6f55d152c140e7879ac79936 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sun, 28 Aug 2022 00:21:40 +0800 Subject: [PATCH] Don't download tarballs if a local git repo found Signed-off-by: Huang Qi --- fs/littlefs/Make.defs | 3 +++ libs/libxx/libcxx.defs | 7 ++++++- libs/libxx/libcxxabi.defs | 4 ++++ openamp/libmetal.defs | 5 +++++ openamp/open-amp.defs | 5 +++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/fs/littlefs/Make.defs b/fs/littlefs/Make.defs index 7d878e2e6e..b922eb5353 100644 --- a/fs/littlefs/Make.defs +++ b/fs/littlefs/Make.defs @@ -49,11 +49,14 @@ $(LITTLEFS_TARBALL): $(Q) mv littlefs/littlefs-$(LITTLEFS_VERSION) littlefs/littlefs $(Q) touch littlefs/.littlefsunpack +# Download and unpack tarball if no git repo found +ifeq ($(wildcard littlefs/littlefs/.git),) context:: .littlefsunpack distclean:: $(call DELFILE, littlefs/.littlefsunpack) $(call DELFILE, littlefs/$(LITTLEFS_TARBALL)) $(call DELDIR, littlefs/littlefs) +endif endif diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs index c79a5eb82c..52f64f9086 100644 --- a/libs/libxx/libcxx.defs +++ b/libs/libxx/libcxx.defs @@ -20,6 +20,8 @@ LIBCXX_VERSION=12.0.0 +# Download and unpack tarball if no git repo found +ifeq ($(wildcard libcxx/.git),) libcxx-$(LIBCXX_VERSION).src.tar.xz: $(Q) curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION)/libcxx-$(LIBCXX_VERSION).src.tar.xz @@ -34,6 +36,7 @@ ifeq ($(CONFIG_LIBC_ARCH_ATOMIC),y) $(Q) patch -p1 < 0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch endif $(Q) touch $@ +endif $(TOPDIR)/include/libcxx: libcxx $(Q) $(DIRLINK) $(CURDIR)/libcxx/include $(TOPDIR)/include/libcxx @@ -41,9 +44,11 @@ $(TOPDIR)/include/libcxx: libcxx context:: $(TOPDIR)/include/libcxx distclean:: - $(Q) $(DELFILE) libcxx-$(LIBCXX_VERSION).src.tar.xz $(Q) $(DIRUNLINK) $(TOPDIR)/include/libcxx +ifeq ($(wildcard libcxx/.git),) + $(Q) $(DELFILE) libcxx-$(LIBCXX_VERSION).src.tar.xz $(call DELDIR, libcxx) +endif CXXFLAGS += -std=c++17 ${shell $(DEFINE) "$(CC)" _LIBCPP_BUILDING_LIBRARY} diff --git a/libs/libxx/libcxxabi.defs b/libs/libxx/libcxxabi.defs index c1ed95192a..ba7209bec6 100644 --- a/libs/libxx/libcxxabi.defs +++ b/libs/libxx/libcxxabi.defs @@ -29,11 +29,15 @@ libcxxabi: libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz $(Q) patch -p0 < 0001-libc-abi-avoid-the-waring-__EXCEPTIONS-is-not-define.patch $(Q) touch $@ + +# Download and unpack tarball if no git repo found +ifeq ($(wildcard libcxxabi/.git),) distclean:: $(Q) $(DELFILE) libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz $(call DELDIR, libcxxabi) context:: libcxxabi +endif ifeq ($(CONFIG_LIBCXXABI), y) CXXFLAGS += ${shell $(DEFINE) "$(CC)" LIBCXX_BUILDING_LIBCXXABI} diff --git a/openamp/libmetal.defs b/openamp/libmetal.defs index 8cd2dc4121..9d7faabd18 100644 --- a/openamp/libmetal.defs +++ b/openamp/libmetal.defs @@ -60,9 +60,12 @@ LIBMETAL_HDRS_SEDEXP := \ s/cmakedefine/undef/g" libmetal.zip: +# Download and unpack tarball if no git repo found +ifeq ($(wildcard libmetal/.git),) $(Q) curl -L https://github.com/OpenAMP/libmetal/archive/v$(VERSION).zip -o libmetal.zip $(Q) unzip -o libmetal.zip $(Q) mv libmetal-$(VERSION) libmetal +endif .libmetal_headers: libmetal.zip $(eval headers := $(wildcard libmetal/lib/compiler/gcc/*.h)) @@ -80,8 +83,10 @@ context:: .libmetal_headers distclean:: $(call DELDIR, $(TOPDIR)$(DELIM)include$(DELIM)metal) +ifeq ($(wildcard libmetal/.git),) $(call DELDIR, libmetal) $(call DELFILE, libmetal.zip) +endif $(call DELFILE, .libmetal_headers) endif diff --git a/openamp/open-amp.defs b/openamp/open-amp.defs index 843b0812bf..e0fcf76fe3 100644 --- a/openamp/open-amp.defs +++ b/openamp/open-amp.defs @@ -30,6 +30,8 @@ CSRCS += open-amp/lib/virtio/virtio.c CSRCS += open-amp/lib/virtio/virtqueue.c open-amp.zip: +# Download and unpack tarball if no git repo found +ifeq ($(wildcard open-amp/.git),) $(Q) curl -L https://github.com/OpenAMP/open-amp/archive/v$(VERSION).zip -o open-amp.zip $(Q) unzip -o open-amp.zip $(Q) mv open-amp-$(VERSION) open-amp @@ -45,6 +47,7 @@ open-amp.zip: $(Q) patch -p0 < 0010-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch $(Q) patch -p0 < 0011-openamp-avoid-double-calling-ns_bound-when-each-othe.patch $(Q) patch -p0 < 0012-remoteproc-make-all-elf_-functions-static-except-elf.patch +endif .openamp_headers: open-amp.zip $(eval headers := $(wildcard open-amp/lib/include/openamp/*.h)) @@ -56,8 +59,10 @@ context:: .openamp_headers distclean:: $(call DELDIR, $(TOPDIR)$(DELIM)include$(DELIM)openamp$(DELIM)) +ifeq ($(wildcard open-amp/.git),) $(call DELDIR, open-amp) $(call DELFILE, open-amp.zip) +endif $(call DELFILE, .openamp_headers) endif