Add SDL developer and user guides
[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 #
18 # This source code is part of the near-RT RIC (RAN Intelligent Controller)
19 # platform project (RICP).
20 #
21
22 set -e
23
24 if [ $# -eq 0 ]
25 then
26    echo "Generate a binary package"
27    echo "Usage: $0 [--target-dir <dir>] [--skip-config] target..."
28    echo "Where possible targets are debian and rpm"
29    exit 1
30 fi
31
32 SKIP_CONF=0
33 BUILD_RPM=0
34 BUILD_DEB=0
35 SKIP_TEST=0
36 TARGET_DIR=/tmp
37
38 for i in "$@"
39 do
40     case "$i" in
41     --target-dir)
42         shift
43         TARGET_DIR=$i
44         ;;
45     --skip-config)
46         SKIP_CONF=1
47         ;;
48     --skip-test)
49         SKIP_TEST=1
50         ;;
51     rpm)
52         BUILD_RPM=1
53         shift
54         ;;
55     debian)
56         BUILD_DEB=1
57         ;;
58     *)
59         echo "Unknown argument $1"
60         exit 1
61         ;;
62     esac
63 done
64
65 if [ $SKIP_CONF -eq 0 ]
66 then
67     ./autogen.sh && ./configure
68 fi
69
70 if [ $BUILD_RPM -ne 0 ]
71 then
72     if [ $SKIP_TEST ]
73     then
74         TESTOPT=--nocheck
75     fi
76     rpmbuild --nodeps $TESTOPT -bb rpm/sdl.spec --define="_sourcedir $PWD" --define="_builddir $PWD" --define="_rpmdir .."
77     cp ../x86_64/*.rpm "$TARGET_DIR"
78 fi
79
80 if [ $BUILD_DEB -ne 0 ]
81 then
82     if [ $SKIP_TEST -eq 1 ]
83     then
84         export DEB_BUILD_OPTIONS="nocheck noddebs"
85     fi
86     debuild -b -us -uc
87 fi