Commit a99b30ad authored by Rafaël Carré's avatar Rafaël Carré

extras/tools: preliminary support for building missing dev tools

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
parent 6385ae3c
#!/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
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
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment