]> git.sesse.net Git - vlc/blob - extras/contrib/contrib.mak
contribs: fixed libiconv hack on Darwin10
[vlc] / extras / contrib / contrib.mak
1 # ***************************************************************************
2 # Makefile : Build vlc-contrib files
3 # ***************************************************************************
4 # Copyright (C) 2003-2010 the VideoLAN team
5 # $Id$
6
7 # Authors: Christophe Massiot <massiot@via.ecp.fr>
8 #          Derk-Jan Hartman <hartman at videolan dot org>
9 #          Christophe Mutricy <xtophe at videolan dot org>
10 #          Felix Paul Kühne <fkuehne at videolan dot org>
11 #
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or    
15 # (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 # ***************************************************************************
26
27 include ./config.mak
28
29 BUILDDIRS = hosts build
30
31 ifdef HAVE_MACOSX
32 TARGETALL=using-bin
33 else
34 TARGETALL=using-src
35 endif
36
37 all: $(TARGETALL)
38
39 using-src:
40         $(MAKE) -C build-src
41
42 ifdef HAVE_DARWIN_10
43         (cd $(PREFIX)/lib && sed -e 's%/usr/lib/libiconv.la%$(PREFIX)/lib/libiconv.la%g' -i.orig *.la && rm -f *.la.orig)
44 endif
45
46 # shortcut
47 src: using-src
48
49 ifdef HAVE_DARWIN_OS
50
51 CONTRIBREV=35
52
53 contrib-macosx-$(ARCH)-$(CONTRIBREV).tar.bz2:
54         $(WGET) http://downloads.videolan.org/pub/videolan/testing/contrib/$@
55
56 .$(CONTRIBREV): contrib-macosx-$(ARCH)-$(CONTRIBREV).tar.bz2
57         @if test -d tmp; then \
58                 echo "Move away ./tmp, it's in the way" ; \
59                 exit 1 ; \
60         fi
61         mkdir tmp
62         mkdir -p $(PREFIX)
63         (cd tmp && tar jxvf ../$<)
64         $(SRCDIR)/change_prefix.sh tmp @@CONTRIB_PREFIX@@  $(PREFIX)
65         (cd tmp && find . -type d) | while read dir; do mkdir -p -- "$(PREFIX)/$$dir"; done
66         (cd tmp && find . -not -type d) | while read i; do mv -f -- tmp/"$$i" "$(PREFIX)/$$i"; done
67         rm -rf tmp
68         # install the gecko-sdk, which isn't part of the package for size and speed reasons
69         (cd build-src && rm -rf *gecko* && $(MAKE) .gecko)
70     # libiconv.la is no longer present on Snow Leopard, so fix possible references to it, which would
71     # result in linking issues
72 ifdef HAVE_MACOSX_DARWIN_10
73         (cd $(PREFIX)/lib && sed -e 's%/usr/lib/libiconv.la%$(PREFIX)/lib/libiconv.la%g' -i.orig *.la && rm -f *.la.orig)
74         (cd build-src && rm -f .iconv && $(MAKE) .iconv)
75 endif
76         touch .$(CONTRIBREV)
77
78 using-bin: .$(CONTRIBREV) 
79
80 endif
81
82 clean:
83         rm -rf $(BUILDDIRS)
84         $(MAKE) -C build-src clean
85
86 clean-bin:
87         rm -rf $(BUILDDIRS)
88         $(MAKE) -C build-src clean-dots
89
90 distclean:
91         $(MAKE) clean
92         $(MAKE) -C build-src clean-src
93         rm -rf config.mak distro.mak
94
95 bin: using-bin
96
97 package-macosx:
98         @if test -d tmp; then \
99                 echo "Move away ./tmp, it's in the way" ; \
100                 exit 1 ; \
101         fi
102         mkdir tmp
103         (cd $(PREFIX); tar cf - Sparkle bin sbin include lib share/aclocal* share/autoconf* \
104                 share/automake* share/gettext* share/libtool*) | (cd tmp; tar xf -)
105         ./change_prefix.sh tmp $(PREFIX) @@CONTRIB_PREFIX@@
106         (cd tmp; tar cf - .) | bzip2 -c > contrib-macosx.tar.bz2
107         rm -rf tmp
108         rm -f contrib-macosx-$(ARCH)-$(CONTRIBREV).tar.bz2
109         mv contrib-macosx.tar.bz2 contrib-macosx-$(ARCH)-$(CONTRIBREV).tar.bz2
110
111 DISTDIR = usr/win$*
112
113 package-win%:
114         @if test -d tmp; then \
115                 echo "Move away ./tmp, it's in the way" ; \
116                 exit 1 ; \
117         fi
118         mkdir -p tmp/$(DISTDIR)
119         (cd $(PREFIX); tar cf - --dereference bin sbin include lib share/aclocal*\
120                 share/autoconf* share/qt4* \
121                 share/automake* share/gettext* gecko-sdk)\
122                 | (cd tmp/$(DISTDIR); tar xpf -)
123 #kludge for live.com
124         mkdir -p tmp/$(DISTDIR)/live.com
125         for i in groupsock liveMedia UsageEnvironment BasicUsageEnvironment; do \
126                 mkdir -p  tmp/$(DISTDIR)/live.com/$$i/include; \
127                 cp -r build-src/live/$$i/include tmp/$(DISTDIR)/live.com/$$i; \
128                 cp build-src/live/$$i/lib$${i}.a  tmp/$(DISTDIR)/live.com/$$i; \
129         done;
130 # Change Prefix.
131         ./change_prefix.sh tmp $(PREFIX) $(DISTDIR)
132 # Remove unused and potentially harmful files (but skip qt4 executables)
133         (cd tmp/$(DISTDIR)/bin && rm -fv `find . -name 'uic.exe' -o -name 'rcc.exe' -o -name 'moc.exe' -o -name '*.exe' -printf '%p '` && chmod a+x * || true)
134 # Tar it.
135         (cd tmp; tar cf - $(DISTDIR)) | bzip2 -c > contrib-`date +%Y%m%d`-win$*-bin-gcc-`$(CC) --version|head -n 1|cut -f 3 -d ' '`-runtime-`/bin/echo -e "#include <_mingw.h>\n#define CONCAT2(a,b) a##b\n#define CONCAT(a,b) CONCAT2(a,b)\n#ifdef __MINGW64_VERSION_MAJOR\nCONCAT(CONCAT(__MINGW64_VERSION_MAJOR,.),__MINGW64_VERSION_MINOR)\n#else\n__MINGW32_VERSION\n#endif"|$(CC) -E -|tail -1`-only.tar.bz2
136         rm -rf tmp
137
138 .PHONY: all clean-src clean-bin clean package-macosx