]> git.sesse.net Git - vlc/commitdiff
extras/tools: preliminary support for building missing dev tools
authorRafaël Carré <funman@videolan.org>
Thu, 3 Nov 2011 21:42:52 +0000 (17:42 -0400)
committerRafaël Carré <funman@videolan.org>
Thu, 3 Nov 2011 21:45:16 +0000 (17:45 -0400)
Needed on platform with poor tools support (== OSX)
TODO:
    find required versions for each tool and check if the system has them
    build GNU tar with xz support if xz was missing

extras/tools/.gitignore [new file with mode: 0644]
extras/tools/bootstrap [new file with mode: 0755]
extras/tools/packages.mak [new file with mode: 0644]
extras/tools/tools.mak [new file with mode: 0644]

diff --git a/extras/tools/.gitignore b/extras/tools/.gitignore
new file mode 100644 (file)
index 0000000..0971f99
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+build/
diff --git a/extras/tools/bootstrap b/extras/tools/bootstrap
new file mode 100755 (executable)
index 0000000..a27bf2e
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+# Copyright © 2011 Rafaël Carré
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+
+export LC_ALL=
+NEEDED=
+
+if [ ! -f tools.mak ]
+then
+       echo "You must run me in ./extras/tools !"
+       exit 1
+fi
+
+check() {
+# FIXME : add version check
+if [ ! $1 --version 2>/dev/null ]
+then
+    echo "$1 not found"
+    NEEDED="$NEEDED .$1"
+fi
+}
+
+check autoconf
+check automake
+check libtool
+check pkg-config
+check xz
+check cmake
+
+[ -n "$NEEDED" ] && mkdir -p build/
+
+CPUS=
+case `uname` in
+    Linux)
+        CPUS=`grep -c ^processor /proc/cpuinfo`
+     ;;
+    Darwin)
+        CPUS=`sysctl hw.ncpu|cut -d: -f2`
+    ;;
+    *)
+        CPUS=1  # default
+     ;;
+esac
+
+
+cat > Makefile << EOF
+MAKEFLAGS += -j$CPUS
+PREFIX=\$(abspath ./build)
+
+all: $NEEDED
+       @echo "You are ready to build VLC and its contribs"
+
+automake: .autoconf
+
+include tools.mak
+EOF
diff --git a/extras/tools/packages.mak b/extras/tools/packages.mak
new file mode 100644 (file)
index 0000000..ddd8ad4
--- /dev/null
@@ -0,0 +1,20 @@
+GNU=http://ftp.gnu.org/gnu
+
+CMAKE_VERSION=2.8.3
+CMAKE_URL=http://www.cmake.org/files/v2.8/cmake-$(CMAKE_VERSION).tar.gz
+
+LIBTOOL_VERSION=2.2.10
+LIBTOOL_URL=$(GNU)/libtool/libtool-$(LIBTOOL_VERSION).tar.gz
+
+AUTOCONF_VERSION=2.68
+AUTOCONF_URL=$(GNU)/autoconf/autoconf-$(AUTOCONF_VERSION).tar.bz2
+
+AUTOMAKE_VERSION=1.11.1
+AUTOMAKE_URL=$(GNU)/automake/automake-$(AUTOMAKE_VERSION).tar.gz
+
+PKGCFG_VERSION=0.23
+#PKGCFG_URL=http://downloads.videolan.org/pub/videolan/testing/contrib/pkg-config-$(PKGCFG_VERSION).tar.gz
+PKGCFG_URL=http://pkgconfig.freedesktop.org/releases/pkg-config-$(PKGCFG_VERSION).tar.gz
+
+XZ_VERSION=5.0.3
+XZ_URL=http://tukaani.org/xz/xz-$(XZ_VERSION).tar.bz2
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
new file mode 100644 (file)
index 0000000..da4fe29
--- /dev/null
@@ -0,0 +1,151 @@
+# Copyright (C) 2003-2011 the VideoLAN team
+#
+# This file is under the same license as the vlc package.
+
+include packages.mak
+
+#
+# common rules
+#
+
+ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
+download = curl -f -L -- "$(1)" > "$@"
+else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
+download = rm -f $@.tmp && \
+       wget --passive -c -p -O $@.tmp "$(1)" && \
+       touch $@.tmp && \
+       mv $@.tmp $@
+else
+download = $(error Neither curl nor wget found!)
+endif
+
+UNPACK = $(RM) -R $@ \
+    $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzf $(f)) \
+    $(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \
+    $(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \
+    $(foreach f,$(filter %.zip,$^), && unzip $(f))
+
+UNPACK_DIR = $(basename $(basename $(notdir $<)))
+APPLY = (cd $(UNPACK_DIR) && patch -p1) <
+MOVE = mv $(UNPACK_DIR) $@ && touch $@
+
+#
+# package rules
+#
+
+# cmake
+
+cmake-$(CMAKE_VERSION).tar.gz:
+       $(download) $(CMAKE_URL)
+
+cmake: cmake-$(CMAKE_VERSION).tar.gz
+       $(UNPACK)
+       $(MOVE)
+
+.cmake: cmake
+       (cd $<; ./configure --prefix=$(PREFIX) && make && make install)
+       touch $@
+
+CLEAN_FILE += .cmake
+CLEAN_PKG += cmake
+DISTCLEAN_PKG += cmake-$(CMAKE_VERSION).tar.gz
+
+# libtool
+
+libtool-$(LIBTOOL_VERSION).tar.gz:
+       $(download) $(LIBTOOL_URL)
+
+libtool: libtool-$(LIBTOOL_VERSION).tar.gz
+       $(UNPACK)
+       $(MOVE)
+
+.libtool: libtool
+       (cd $<; ./configure --prefix=$(PREFIX) && make && make install)
+       ln -sf libtool $(PREFIX)/bin/glibtool
+       ln -sf libtoolize $(PREFIX)/bin/glibtoolize
+       touch $@
+
+CLEAN_PKG += libtool
+DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
+CLEAN_FILE += .libtool
+
+# xz
+
+xz-$(XZ_VERSION).tar.bz2:
+       $(download) $(XZ_URL)
+
+xz: xz-$(XZ_VERSION).tar.bz2
+       $(UNPACK)
+       $(MOVE)
+
+.xz: xz
+       (cd $<; ./configure --prefix=$(PREFIX) && make && make install)
+       touch $@
+
+CLEAN_PKG += xz
+DISTCLEAN_PKG += xz-$(XZ_VERSION).tar.bz2
+CLEAN_FILE += .xz
+
+# autoconf
+
+autoconf-$(AUTOCONF_VERSION).tar.bz2:
+       $(download) $(AUTOCONF_URL)
+
+autoconf: autoconf-$(AUTOCONF_VERSION).tar.bz2
+       $(UNPACK)
+       $(MOVE)
+
+.autoconf: autoconf
+       (cd $<; ./configure --prefix=$(PREFIX) && make && make install)
+       touch $@
+
+CLEAN_FILE += .autoconf
+CLEAN_PKG += autoconf
+DISTCLEAN_PKG += autoconf-$(AUTOCONF_VERSION).tar.bz2
+
+# automake
+
+automake-$(AUTOMAKE_VERSION).tar.gz:
+       $(download) $(AUTOMAKE_URL)
+
+automake: automake-$(AUTOMAKE_VERSION).tar.gz
+       $(UNPACK)
+       $(MOVE)
+
+.automake: automake .autoconf
+       (cd $<; ./configure --prefix=$(PREFIX) && make && make install)
+       touch $@
+
+CLEAN_FILE += .automake
+CLEAN_PKG += automake
+DISTCLEAN_PKG += automake-$(AUTOMAKE_VERSION).tar.gz
+
+# pkg-config
+
+pkg-config-$(PKGCFG_VERSION).tar.gz:
+       $(download) $(PKGCFG_URL)
+
+pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
+       $(UNPACK)
+       $(MOVE)
+       (cd $@; autoconf)
+
+.pkg-config: pkgconfig
+       (cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
+       touch $@
+
+CLEAN_FILE += .pkg-config
+CLEAN_PKG += pkgconfig
+DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz
+
+#
+#
+#
+
+clean:
+       rm -fr $(CLEAN_FILE) $(CLEAN_PKG) build/
+
+distclean: clean
+       rm -fr $(DISTCLEAN_PKG)
+
+.PHONY: all clean distclean