1#! /bin/sh
2#############################################################################
3##
4## Copyright (C) 2017 André Klitzing
5## Contact: https://www.qt.io/licensing/
6##
7## This file is the build configuration utility of the Qt Toolkit.
8##
9## $QT_BEGIN_LICENSE:LGPL$
10## Commercial License Usage
11## Licensees holding valid commercial Qt licenses may use this file in
12## accordance with the commercial license agreement provided with the
13## Software or, alternatively, in accordance with the terms contained in
14## a written agreement between you and The Qt Company. For licensing terms
15## and conditions see https://www.qt.io/terms-conditions. For further
16## information use the contact form at https://www.qt.io/contact-us.
17##
18## GNU Lesser General Public License Usage
19## Alternatively, this file may be used under the terms of the GNU Lesser
20## General Public License version 3 as published by the Free Software
21## Foundation and appearing in the file LICENSE.LGPL3 included in the
22## packaging of this file. Please review the following information to
23## ensure the GNU Lesser General Public License version 3 requirements
24## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25##
26## GNU General Public License Usage
27## Alternatively, this file may be used under the terms of the GNU
28## General Public License version 2.0 or (at your option) the GNU General
29## Public license version 3 or any later version approved by the KDE Free
30## Qt Foundation. The licenses are as published by the Free Software
31## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32## included in the packaging of this file. Please review the following
33## information to ensure the GNU General Public License requirements will
34## be met: https://www.gnu.org/licenses/gpl-2.0.html and
35## https://www.gnu.org/licenses/gpl-3.0.html.
36##
37## $QT_END_LICENSE$
38##
39#############################################################################
40
41# This is a small script to copy the required files from a libpng tarball
42# into 3rdparty/libpng/
43
44if [ $# -ne 2 ]; then
45    echo "Usage: $0 libpng_tarball_dir/ \$QTDIR/src/3rdparty/libpng/"
46    exit 1
47fi
48
49LIBPNG_DIR=$1
50TARGET_DIR=$2
51
52if [ ! -d "$LIBPNG_DIR" -o ! -r "$LIBPNG_DIR" -o ! -d "$TARGET_DIR" -o ! -w "$TARGET_DIR" ]; then
53    echo "Either the libpng source dir or the target dir do not exist,"
54    echo "are not directories or have the wrong permissions."
55    exit 2
56fi
57
58# with 1 argument, copies LIBPNG_DIR/$1 to TARGET_DIR/$1
59# with 2 arguments, copies LIBPNG_DIR/$1 to TARGET_DIR/$2
60copy_file() {
61    if [ $# -lt 1 -o $# -gt 2  ]; then
62        echo "Wrong number of arguments to copy_file"
63        exit 3
64    fi
65
66    SOURCE_FILE=$1
67    if [ -n "$2" ]; then
68        DEST_FILE=$2
69    else
70        DEST_FILE=$1
71    fi
72
73    mkdir -p "$TARGET_DIR/$(dirname "$SOURCE_FILE")"
74    cp "$LIBPNG_DIR/$SOURCE_FILE" "$TARGET_DIR/$DEST_FILE"
75}
76
77copy_file "scripts/pnglibconf.h.prebuilt" "pnglibconf.h"
78
79FILES="
80   ANNOUNCE
81   README
82   CHANGES
83   LICENSE
84   INSTALL
85   libpng-manual.txt
86
87   png.c
88   pngerror.c
89   pngget.c
90   pngmem.c
91   pngpread.c
92   pngread.c
93   pngrio.c
94   pngrtran.c
95   pngrutil.c
96   pngset.c
97   pngtrans.c
98   pngwio.c
99   pngwrite.c
100   pngwtran.c
101   pngwutil.c
102
103   png.h
104   pngpriv.h
105   pngstruct.h
106   pnginfo.h
107   pngconf.h
108   pngdebug.h
109"
110
111for i in $FILES; do
112    copy_file "$i" "$i"
113done
114