Skip to content

Commit 04cd09a

Browse files
Kerry BillinghamKerry Billingham
authored andcommitted
Updated package dependency list & package check script.
1 parent 9313978 commit 04cd09a

File tree

2 files changed

+80
-20
lines changed

2 files changed

+80
-20
lines changed

platforms/maven/opencv/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
<workingDirectory>${project.basedir}/scripts</workingDirectory>
6868
<arguments>
6969
<argument>deb_package_check</argument>
70+
<argument>-olibpng-dev|libpng12-dev</argument>
71+
<argument>-olibopenjp2-7-dev|libjasper-dev</argument>
72+
<argument>-opython-dev</argument>
73+
<argument>-opython-numpy</argument>
7074
<argument>build-essential</argument>
7175
<argument>cmake</argument>
7276
<argument>git</argument>
@@ -75,14 +79,10 @@
7579
<argument>libavcodec-dev</argument>
7680
<argument>libavformat-dev</argument>
7781
<argument>libswscale-dev</argument>
78-
<argument>python-dev</argument>
79-
<argument>python-numpy</argument>
8082
<argument>libtbb2</argument>
8183
<argument>libtbb-dev</argument>
8284
<argument>libjpeg-dev</argument>
83-
<argument>libpng12-dev</argument>
8485
<argument>libtiff5-dev</argument>
85-
<argument>libjasper-dev</argument>
8686
<argument>libdc1394-22-dev</argument>
8787
<argument>execstack</argument>
8888
<argument>ant</argument>
@@ -182,13 +182,13 @@
182182
<requireEnvironmentVariable>
183183
<level>WARN</level>
184184
<variableName>JAVA_HOME</variableName>
185-
<message>$JAVA_HOME is not set. Build WILL fail.</message>
185+
<message>$JAVA_HOME is not set. Build may fail.</message>
186186
</requireEnvironmentVariable>
187187
<requireEnvironmentVariable>
188188
<level>WARN</level>
189189
<variableName>MAKEFLAGS</variableName>
190190
<message>No MAKEFLAGS environment variable. Build may be slow.
191-
To speed up the build you can try exporting MAKEFLAGS=-jX where X equals the number of parallel builds.</message>
191+
To speed up the build you can try exporting MAKEFLAGS=-jX where X equals the number of parallel builds.</message>
192192
</requireEnvironmentVariable>
193193
</rules>
194194
</configuration>

platforms/maven/opencv/scripts/deb_package_check

Lines changed: 74 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
#!/bin/bash
2-
###########################################################################################
2+
##################################################################################################
33
#
44
# This script checks for the required Debian packages are installed
55
# to build OpenCV.
66
# Commandline parameters:
7-
# $@ - These are the names of the packages to check with 'dpkg'
7+
# $@ These are the names of the packages to check with 'dpkg'. Multiple values may
8+
# be specified per package by using pipe as a delimiter, e.g. libpng-dev|libpng12-dev.
9+
# Multiple values are evaluated left-to-right and the first found prevents checking of
10+
# the remaining package options.
11+
#
12+
# -o <package_name> Specifying this switch with a package name marks it as optional
13+
# i.e. it is not required to be installed.
814
#
915
# Returns:
1016
# 0 - All packages installed (success)
@@ -13,29 +19,83 @@
1319
# Kerry Billingham <contact (at) avionicengineers (d0t) com>
1420
# 20 April 2016
1521
#
16-
###########################################################################################
22+
##################################################################################################
1723
red=$'\e[1;31m'
1824
green=$'\e[1;32m'
25+
yellow=$'\e[1;33m'
1926
end=$'\e[0m'
20-
check_message="Checking for 'dpkg'"
27+
check_message="Checking for "
28+
declare -i packageMissing=0
29+
declare -i installed=1
30+
31+
#########################
32+
# Function declarations.
33+
#########################
34+
function check_package() {
35+
check_message="Checking for package "
36+
dpkg -s $1 &>/dev/null
37+
is_installed=$?
38+
if [ ${is_installed} -ne 0 ]; then
39+
printf "%-80s%s\n" "$2${check_message}${red}$1" " MISSING.${end}"
40+
packageMissing=1
41+
else
42+
printf "%-80s%s\n" "$2${check_message}${green}$1" " INSTALLED.${end}"
43+
packageMissing=0
44+
fi
45+
return $is_installed
46+
}
47+
48+
# Main part of script.
49+
ORIGINAL_IFS=$IFS
50+
2151
dpkg -? &>/dev/null
2252
if [ $? -ne 0 ]; then
23-
printf "%-80s%s\n" "${check_message}" "${red} MISSING.${end}"
53+
printf "%-80s%s\n" "${check_message} ${red}'dpkg'" " MISSING.${end}"
2454
exit 1
2555
else
26-
printf "%-80s%s\n" "${check_message}" "${green} INSTALLED.${end}"
56+
printf "%-80s%s\n" "${check_message} ${green}'dpkg'" " INSTALLED.${end}"
2757
fi
2858

29-
declare -i packageMissing=0
30-
packageArray=( "$@" )
59+
while getopts o: option; do
60+
case $option in
61+
o)
62+
IFS="|"
63+
packageChoices=( ${OPTARG} )
64+
if [ ${#packageChoices[@]} -gt 1 ]; then
65+
echo "Optional package. One of ${yellow}${packageChoices[@]}${end} can be installed."
66+
for choice in ${packageChoices[@]}; do
67+
check_package ${choice} " "
68+
if [ $? -eq 0 ]; then
69+
break
70+
fi
71+
done
72+
else
73+
echo "Optional package ${yellow}${packageChoices}${end}"
74+
check_package ${OPTARG} " "
75+
fi
76+
IFS=$ORIGINAL_IFS
77+
;;
78+
\?)
79+
echo "No option found"
80+
;;
81+
esac
82+
done
83+
84+
shift $((OPTIND-1))
85+
packageArray=( $@ )
3186
for package in ${packageArray[@]}; do
32-
check_message="Checking for package ${package}"
33-
dpkg -s ${package} &>/dev/null
34-
if [ $? -ne 0 ]; then
35-
printf "%-80s%s\n" "${check_message}" "${red} MISSING.${end}"
36-
packageMissing=1
87+
IFS="|"
88+
packageChoices=( ${package} )
89+
if [ ${#packageChoices[@]} -gt 1 ]; then
90+
echo "Multiple options. One of ${yellow}${packageChoices[@]}${end} must be installed."
91+
for choice in ${packageChoices[@]}; do
92+
check_package ${choice} " "
93+
if [ $? -eq 0 ]; then
94+
break
95+
fi
96+
done
3797
else
38-
printf "%-80s%s\n" "${check_message}" "${green} INSTALLED.${end}"
98+
check_package ${package} ""
3999
fi
40100
done
41101

0 commit comments

Comments
 (0)