fix smoketest linkage
[LibreOffice.git] / bin / unpack-sources
blob130c9a293c7d87db4dbcc179a67567b4fc349cf6
1 #!/usr/bin/env bash
3 # Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License or as specified alternatively below. You may obtain a copy of
8 # the License at http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Initial Developer of the Original Code is
16 # Petr Mladek <pmladek@suse.cz>
17 # Portions created by the Initial Developer are Copyright (C) 2011 the
18 # Initial Developer. All Rights Reserved.
20 # Major Contributor(s):
21 # Ted <ted@bear.com>
22 # Portions created by the Ted are Copyright (C) 2010 Ted. All Rights Reserved.
24 # For minor contributions see the git repository.
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 3 or later (the "GPLv3+"), or
28 # the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
29 # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
30 # instead of those above.
32 usage()
34 echo "Helper script to unpack the LO source tarbals"
35 echo
36 echo "Usage: ${0##*/} [--help] start-dir tarball..."
37 echo
38 echo "Options:"
39 echo
40 echo " --help this help"
41 echo " start-dir path where the sources are unpacked (bootstrap directory)"
42 echo " tarball list of LO source tarball that need to be unpacked"
45 start_dir=
46 tarballs=
48 while test -n "$1" ; do
49 case "$1" in
50 --help)
51 usage
52 exit 0;
54 --download)
55 download="yes"
57 -*)
58 echo "Error: unknown option: $1"
59 exit 1;
62 if test -z "$start_dir" ; then
63 start_dir="$1"
64 else
65 tarballs="$tarballs $1"
68 esac
69 shift
70 done
72 if test -z "$start_dir" ; then
73 echo "Error: Please, define where to unpack sources, try --help"
76 if ! test -d $start_dir/src -a -f $start_dir/solenv/inc/target.mk ; then
77 echo "Error: $start_dir is not a valid bootstrap directory"
78 exit 1;
81 if test ! -f $start_dir/bootstrap.ver -o -d $start_dir/.git ; then
82 echo "Warning: bootstrap sources are from git and not from tarball"
83 echo " Do nothing."
84 exit 0;
87 source $start_dir/bootstrap.ver
88 lo_src_dir="$start_dir/src"
89 mkdir -p "$lo_src_dir"
91 for tarball in $tarballs ; do
92 tarname=`basename $tarball | sed -e "s/.tar.bz2//"`
93 if test -d $lo_src_dir/$tarname ; then
94 echo "Warning: $lo_src_dir/$tarname already exists => skipping"
95 continue;
98 echo "Unpacking $tarname..."
99 tar -xjf "$tarball" -C "$lo_src_dir"
101 # create symlinks
102 for dir in `find "$lo_src_dir/$tarname" -mindepth 1 -maxdepth 1 -type d -printf "$tarname/%f\n"` ; do
103 ln -sf "src/$dir" "$start_dir"
104 done
105 done