Fix copyright statement of SDL documentation
[ric-plt/sdl.git] / package.sh
1 #!/bin/bash
2 #
3 # Copyright (c) 2018-2019 Nokia.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 set -e
18
19 if [ $# -eq 0 ]
20 then
21    echo "Generate a binary package"
22    echo "Usage: $0 [--target-dir <dir>] [--skip-config] target..."
23    echo "Where possible targets are debian and rpm"
24    exit 1
25 fi
26
27 SKIP_CONF=0
28 BUILD_RPM=0
29 BUILD_DEB=0
30 SKIP_TEST=0
31 TARGET_DIR=/tmp
32
33 for i in "$@"
34 do
35     case "$i" in
36     --target-dir)
37         shift
38         TARGET_DIR=$i
39         ;;
40     --skip-config)
41         SKIP_CONF=1
42         ;;
43     --skip-test)
44         SKIP_TEST=1
45         ;;
46     rpm)
47         BUILD_RPM=1
48         shift
49         ;;
50     debian)
51         BUILD_DEB=1
52         ;;
53     *)
54         echo "Unknown argument $1"
55         exit 1
56         ;;
57     esac
58 done
59
60 if [ $SKIP_CONF -eq 0 ]
61 then
62     ./autogen.sh && ./configure
63 fi
64
65 if [ $BUILD_RPM -ne 0 ]
66 then
67     if [ $SKIP_TEST ]
68     then
69         TESTOPT=--nocheck
70     fi
71     rpmbuild --nodeps $TESTOPT -bb rpm/sdl.spec --define="_sourcedir $PWD" --define="_builddir $PWD" --define="_rpmdir .."
72     cp ../x86_64/*.rpm "$TARGET_DIR"
73 fi
74
75 if [ $BUILD_DEB -ne 0 ]
76 then
77     if [ $SKIP_TEST -eq 1 ]
78     then
79         export DEB_BUILD_OPTIONS="nocheck noddebs"
80     fi
81     debuild -b -us -uc
82 fi