tools: allow building tools out of the source tree
authorSteve Lhomme <robux4@ycbcr.xyz>
Fri, 3 May 2019 10:52:43 +0000 (12:52 +0200)
committerSteve Lhomme <robux4@ycbcr.xyz>
Wed, 29 May 2019 12:05:18 +0000 (14:05 +0200)
This is convenient when using one source tree with different compilers/OSes.
For example when C++ standard library differs between versions (since most of
the time we need to build protoc).
You can keep one set of tools per environment.

extras/tools/bootstrap
extras/tools/tools.mak

index 852ed55..544429e 100755 (executable)
@@ -19,12 +19,6 @@ export LC_ALL=
 NEEDED=
 FOUND=
 
-if [ ! -f tools.mak ]
-then
-       echo "You must run me in ./extras/tools !"
-       exit 1
-fi
-
 check_version() {
     gotver=$2
     gotmajor=`echo $gotver|cut -d. -f1`
@@ -177,7 +171,10 @@ case `uname` in
      ;;
 esac
 
+BOOTSTRAP_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
+
 cat > Makefile << EOF
+TOOLS = $BOOTSTRAP_PATH
 MAKEFLAGS += -j$CPUS
 CMAKEFLAGS += --parallel=$CPUS
 PREFIX=\$(abspath ./build)
@@ -205,5 +202,5 @@ cat >> Makefile << EOF
 all: $TARGETS
        @echo "You are ready to build VLC and its contribs"
 
-include tools.mak
+include \$(TOOLS)/tools.mak
 EOF
index bd3c27b..7d677de 100644 (file)
@@ -2,7 +2,8 @@
 #
 # This file is under the same license as the vlc package.
 
-include packages.mak
+include $(TOOLS)/packages.mak
+TARBALLS := $(TOOLS)
 
 #
 # common rules
@@ -36,7 +37,7 @@ endif
 
 download_pkg = $(call download,$(VIDEOLAN)/$(2)/$(lastword $(subst /, ,$(@)))) || \
        ( $(call download,$(1)) && echo "Please upload package $(lastword $(subst /, ,$(@))) to our FTP" )  \
-       && grep $(@) SHA512SUMS| $(SHA512SUM)
+       && grep $(@) $(TOOLS)/SHA512SUMS| $(SHA512SUM)
 
 UNPACK = $(RM) -R $@ \
     $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzfo $(f)) \
@@ -91,7 +92,7 @@ cmake-$(CMAKE_VERSION).tar.gz:
 
 cmake: cmake-$(CMAKE_VERSION).tar.gz
        $(UNPACK)
-       $(APPLY) cmake-msys-FindPkg.patch
+       $(APPLY) $(TOOLS)/cmake-msys-FindPkg.patch
        $(MOVE)
 
 .buildcmake: cmake
@@ -126,10 +127,10 @@ libtool-$(LIBTOOL_VERSION).tar.gz:
 libtool: libtool-$(LIBTOOL_VERSION).tar.gz
        $(UNPACK)
        (cd $(UNPACK_DIR) && chmod u+w build-aux/ltmain.sh)
-       $(APPLY) libtool-2.4.6-bitcode.patch
-       $(APPLY) libtool-2.4.6-san.patch
-       $(APPLY) libtool-2.4.6-clang-libs.patch
-       $(APPLY) libtool-2.4.6-response-files.patch
+       $(APPLY) $(TOOLS)/libtool-2.4.6-bitcode.patch
+       $(APPLY) $(TOOLS)/libtool-2.4.6-san.patch
+       $(APPLY) $(TOOLS)/libtool-2.4.6-clang-libs.patch
+       $(APPLY) $(TOOLS)/libtool-2.4.6-response-files.patch
        (cd $(UNPACK_DIR) && autoreconf)
        $(MOVE)
 
@@ -201,7 +202,7 @@ automake-$(AUTOMAKE_VERSION).tar.gz:
 
 automake: automake-$(AUTOMAKE_VERSION).tar.gz
        $(UNPACK)
-       $(APPLY) automake-clang.patch
+       $(APPLY) $(TOOLS)/automake-clang.patch
        $(MOVE)
 
 .buildautomake: automake .autoconf
@@ -219,8 +220,8 @@ m4-$(M4_VERSION).tar.gz:
 
 m4: m4-$(M4_VERSION).tar.gz
        $(UNPACK)
-       $(APPLY) bison-macOS-c41f233c.patch
-       $(APPLY) bison-macOS-7df04f9.patch
+       $(APPLY) $(TOOLS)/bison-macOS-c41f233c.patch
+       $(APPLY) $(TOOLS)/bison-macOS-7df04f9.patch
        $(MOVE)
 
 .buildm4: m4
@@ -272,7 +273,7 @@ ragel-$(RAGEL_VERSION).tar.gz:
 
 ragel: ragel-$(RAGEL_VERSION).tar.gz
        $(UNPACK)
-       $(APPLY) ragel-6.8-javacodegen.patch
+       $(APPLY) $(TOOLS)/ragel-6.8-javacodegen.patch
        $(MOVE)
 
 
@@ -347,8 +348,8 @@ bison-$(BISON_VERSION).tar.xz:
 
 bison: bison-$(BISON_VERSION).tar.xz
        $(UNPACK)
-       $(APPLY) bison-macOS-c41f233c.patch
-       $(APPLY) bison-macOS-7df04f9.patch
+       $(APPLY) $(TOOLS)/bison-macOS-c41f233c.patch
+       $(APPLY) $(TOOLS)/bison-macOS-7df04f9.patch
        $(MOVE)
 
 .buildbison: bison