[vlc-devel] [PATCH 3/3] extras/tools: Add an intermediate build target
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Jul 12 14:20:11 CEST 2018
This allows us to have dependencies across targets, but without
rebuilding them when it's unnecessary
---
extras/tools/bootstrap | 39 +++++++++++++++++++++++++++++----------
extras/tools/tools.mak | 38 +++++++++++++++++++-------------------
2 files changed, 48 insertions(+), 29 deletions(-)
diff --git a/extras/tools/bootstrap b/extras/tools/bootstrap
index 72e5d2a83d..197ab00e4d 100755
--- a/extras/tools/bootstrap
+++ b/extras/tools/bootstrap
@@ -17,6 +17,7 @@
export LC_ALL=
NEEDED=
+FOUND=
if [ ! -f tools.mak ]
then
@@ -39,7 +40,9 @@ check_version() {
-o "$needmajor" -eq "$gotmajor" -a "$needminor" -eq "$gotminor" -a "$needmicro" -gt "$gotmicro" ]
then
echo "$1 too old"
- NEEDED="$NEEDED .$1"
+ NEEDED="$NEEDED $1"
+ else
+ FOUND="$FOUND $1"
fi
}
@@ -54,7 +57,9 @@ check_version_majmin() {
-o "$needminor" -ne "$gotminor" ]
then
echo "$1 not compatible"
- NEEDED="$NEEDED .$1"
+ NEEDED="$NEEDED $1"
+ else
+ FOUND="$FOUND $1"
fi
}
@@ -63,7 +68,9 @@ check_tar() {
if ! tar PcJ /dev/null >/dev/null 2>&1 && ! tar PcJf /dev/null /dev/null 2>&1
then
echo "tar doesn't support xz (J option)"
- NEEDED="$NEEDED .tar .xz"
+ NEEDED="$NEEDED tar xz"
+else
+ FOUND="$FOUND tar xz"
fi
}
@@ -74,7 +81,9 @@ echo "test file for GNU sed" > $tmp
if ! sed -i -e 's/sed//' $tmp >/dev/null 2>&1
then
echo "sed doesn't do in-place editing (-i option)"
- NEEDED="$NEEDED .sed"
+ NEEDED="$NEEDED sed"
+else
+ FOUND="$FOUND sed"
fi
}
@@ -82,7 +91,7 @@ check_nasm() {
if ! nasm -v >/dev/null 2>&1
then
echo "nasm not found"
- NEEDED="$NEEDED .nasm"
+ NEEDED="$NEEDED nasm"
else
# found, need to check version ?
[ -z "$1" ] && return # no
@@ -95,7 +104,7 @@ check() {
if ! $1 --version >/dev/null 2>&1 && ! $1 -version >/dev/null 2>&1
then
echo "$1 not found"
- NEEDED="$NEEDED .$1"
+ NEEDED="$NEEDED $1"
else
# found, need to check version ?
[ -z "$2" ] && return # no
@@ -108,7 +117,7 @@ check_majmin() {
if ! $1 --version >/dev/null 2>&1 && ! $1 -version >/dev/null 2>&1 && ! $1 --version 2>/dev/null
then
echo "$1 not found"
- NEEDED="$NEEDED .$1"
+ NEEDED="$NEEDED $1"
else
# found, need to check version ?
[ -z "$2" ] && return # no
@@ -136,7 +145,7 @@ check_nasm 2.13.01
check gettext
check help2man
-[ -n "$NEEDED" ] && mkdir -p build/ && echo "To-be-built packages: `echo $NEEDED | sed 's/\.//g'`"
+[ -n "$NEEDED" ] && mkdir -p build/ && echo "To-be-built packages: $NEEDED"
CPUS=
case `uname` in
@@ -157,13 +166,23 @@ case `uname` in
;;
esac
-
cat > Makefile << EOF
MAKEFLAGS += -j$CPUS
CMAKEFLAGS += --parallel=$CPUS
PREFIX=\$(abspath ./build)
+EOF
+
+for t in $FOUND; do
+ echo ".$t:" >> Makefile
+done
+
+for t in $NEEDED; do
+ echo .$t: .build$t >> Makefile
+ TARGETS="$TARGETS .build$t"
+done
-all: $NEEDED
+cat >> Makefile << EOF
+all: $TARGETS
@echo "You are ready to build VLC and its contribs"
include tools.mak
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index 896d624ad9..8293ff184c 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -51,7 +51,7 @@ yasm: yasm-$(YASM_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.yasm: yasm
+.buildyasm: yasm
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -66,7 +66,7 @@ nasm: nasm-$(NASM_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.nasm: nasm
+.buildnasm: nasm
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -84,7 +84,7 @@ cmake: cmake-$(CMAKE_VERSION).tar.gz
$(APPLY) cmake-winstore.patch
$(MOVE)
-.cmake: cmake
+.buildcmake: cmake
(cd $<; ./configure --prefix=$(PREFIX) $(CMAKEFLAGS) && $(MAKE) && $(MAKE) install)
touch $@
@@ -100,7 +100,7 @@ help2man: help2man-$(HELP2MAN_VERSION).tar.xz
$(UNPACK)
$(MOVE)
-.help2man: help2man
+.buildhelp2man: help2man
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -116,7 +116,7 @@ libtool: libtool-$(LIBTOOL_VERSION).tar.gz
$(APPLY) libtool-2.4.6-clang-libs.patch
$(MOVE)
-.libtool: libtool .automake .help2man
+.buildlibtool: libtool .automake .help2man
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
ln -sf libtool $(PREFIX)/bin/glibtool
ln -sf libtoolize $(PREFIX)/bin/glibtoolize
@@ -135,7 +135,7 @@ tar: tar-$(TAR_VERSION).tar.bz2
$(UNPACK)
$(MOVE)
-.tar: tar
+.buildtar: tar
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -152,7 +152,7 @@ xz: xz-$(XZ_VERSION).tar.bz2
$(UNPACK)
$(MOVE)
-.xz: xz
+.buildxz: xz
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install && rm $(PREFIX)/lib/pkgconfig/liblzma.pc)
touch $@
@@ -169,7 +169,7 @@ autoconf: autoconf-$(AUTOCONF_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.autoconf: autoconf .pkg-config
+.buildautoconf: autoconf .pkg-config
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -186,7 +186,7 @@ automake: automake-$(AUTOMAKE_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.automake: automake .autoconf
+.buildautomake: automake .autoconf
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -205,7 +205,7 @@ m4: m4-$(M4_VERSION).tar.gz
$(APPLY) bison-macOS-7df04f9.patch
$(MOVE)
-.m4: m4
+.buildm4: m4
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -223,7 +223,7 @@ pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
mv pkg-config-lite-$(PKGCFG_VERSION) pkg-config-$(PKGCFG_VERSION)
$(MOVE)
-.pkg-config: pkgconfig
+.buildpkg-config: pkgconfig
(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
touch $@
@@ -239,7 +239,7 @@ gas: gas-preprocessor-$(GAS_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.gas: gas
+.buildgas: gas
mkdir -p $(PREFIX)/bin
cp gas/gas-preprocessor.pl $(PREFIX)/bin/
touch $@
@@ -258,7 +258,7 @@ ragel: ragel-$(RAGEL_VERSION).tar.gz
$(MOVE)
-.ragel: ragel
+.buildragel: ragel
(cd ragel; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
touch $@
@@ -275,7 +275,7 @@ sed: sed-$(SED_VERSION).tar.bz2
$(UNPACK)
$(MOVE)
-.sed: sed
+.buildsed: sed
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -292,7 +292,7 @@ ant: apache-ant-$(ANT_VERSION).tar.bz2
$(UNPACK)
$(MOVE)
-.ant: ant
+.buildant: ant
(mkdir -p $(PREFIX)/bin && cp $</bin/* $(PREFIX)/bin/)
(mkdir -p $(PREFIX)/lib && cp $</lib/* $(PREFIX)/lib/)
touch $@
@@ -311,7 +311,7 @@ protobuf: protobuf-$(PROTOBUF_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.protoc: protobuf
+.buildprotoc: protobuf
(cd $< && ./configure --prefix="$(PREFIX)" --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
(find $(PREFIX) -name 'protobuf*.pc' -exec rm -f {} \;)
touch $@
@@ -333,7 +333,7 @@ bison: bison-$(BISON_VERSION).tar.xz
$(APPLY) bison-macOS-7df04f9.patch
$(MOVE)
-.bison: bison
+.buildbison: bison
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -352,7 +352,7 @@ flex: flex-$(FLEX_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.flex: flex
+.buildflex: flex
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
@@ -373,7 +373,7 @@ gettext: gettext-$(GETTEXT_VERSION).tar.gz
$(UNPACK)
$(MOVE)
-.gettext: gettext
+.buildgettext: gettext
(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
touch $@
--
2.18.0
More information about the vlc-devel
mailing list