Skip to content

Commit 60a324b

Browse files
committed
add build deps check. closes kivy#68
1 parent f88cae1 commit 60a324b

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

distribute.sh

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,36 @@ function usage() {
223223
exit 0
224224
}
225225

226+
# Check installation state of a debian package list.
227+
# Return all missing packages.
228+
function check_pkg_deb_installed() {
229+
PKGS=$1
230+
MISSING_PKGS=""
231+
for PKG in $PKGS; do
232+
CHECK=$(dpkg -s $PKG 2>&1)
233+
if [ $? -eq 1 ]; then
234+
MISSING_PKGS="$PKG $MISSING_PKGS"
235+
fi
236+
done
237+
if [ "X$MISSING_PKGS" != "X" ]; then
238+
error "Packages missing: $MISSING_PKGS"
239+
error "It might break the compilation, except if you installed thoses packages manually."
240+
fi
241+
}
242+
243+
function check_build_deps() {
244+
DIST=$(lsb_release -is)
245+
info "Check build dependencies for $DIST"
246+
case $DIST in
247+
Debian|Ubuntu)
248+
check_pkg_deb_installed "build-essential zlib1g-dev cython"
249+
;;
250+
*)
251+
debug "Avoid check build dependencies, unknow platform $DIST"
252+
;;
253+
esac
254+
}
255+
226256
function run_prepare() {
227257
info "Check enviromnent"
228258
if [ "X$ANDROIDSDK" == "X" ]; then
@@ -593,6 +623,7 @@ function run_biglink() {
593623
}
594624

595625
function run() {
626+
check_build_deps
596627
run_prepare
597628
run_source_modules
598629
run_get_packages
@@ -653,9 +684,9 @@ while getopts ":hvlfxm:d:s" opt; do
653684
f)
654685
DO_CLEAN_BUILD=1
655686
;;
656-
x)
657-
DO_SET_X=1
658-
;;
687+
x)
688+
DO_SET_X=1
689+
;;
659690
\?)
660691
echo "Invalid option: -$OPTARG" >&2
661692
exit 1

0 commit comments

Comments
 (0)