From fe281924382f244cc0a4745fab39f102a3f1f913 Mon Sep 17 00:00:00 2001
From: orbea <orbea@fredslev.dk>
Date: Fri, 8 Feb 2019 12:28:15 -0800
Subject: [PATCH] qb: Init some variables.

---
 qb/config.libs.sh | 6 ++++--
 qb/qb.comp.sh     | 5 +++++
 qb/qb.libs.sh     | 9 ++++++++-
 qb/qb.make.sh     | 1 +
 qb/qb.moc.sh      | 2 ++
 qb/qb.params.sh   | 4 +++-
 qb/qb.system.sh   | 2 +-
 7 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/qb/config.libs.sh b/qb/config.libs.sh
index 14560193f8..27a36ed475 100644
--- a/qb/config.libs.sh
+++ b/qb/config.libs.sh
@@ -9,20 +9,22 @@ add_define MAKEFILE NOUNUSED_VARIABLE "$HAVE_NOUNUSED_VARIABLE"
 
 [ -z "$CROSS_COMPILE" ] && [ -d /opt/local/lib ] && add_dirs LIBRARY /opt/local/lib
 
-[ "$GLOBAL_CONFIG_DIR" ] || \
+[ "${GLOBAL_CONFIG_DIR:-}" ] ||
 {	case "$PREFIX" in
 		/usr*) GLOBAL_CONFIG_DIR=/etc ;;
 		*) GLOBAL_CONFIG_DIR="$PREFIX"/etc ;;
 	esac
 }
 
-DYLIB=-ldl;
+DYLIB=-ldl
 CLIB=-lc
 PTHREADLIB=-lpthread
 SOCKETLIB=-lc
 SOCKETHEADER=
 INCLUDES='usr/include usr/local/include'
 SORT='sort'
+EXTRA_GL_LIBS=''
+VC_PREFIX=''
 
 if [ "$OS" = 'BSD' ]; then
    [ -d /usr/local/include ] && add_dirs INCLUDE /usr/local/include
diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh
index c65d176f51..01183b4e3e 100644
--- a/qb/qb.comp.sh
+++ b/qb/qb.comp.sh
@@ -4,6 +4,11 @@ TEMP_C=.tmp.c
 TEMP_CXX=.tmp.cxx
 TEMP_EXE=.tmp
 
+CC="${CC:-}"
+CXX="${CXX:-}"
+PKG_CONF_PATH="${PKG_CONF_PATH:-}"
+WINDRES="${WINDRES:-}"
+
 # Checking for working C compiler
 cat << EOF > "$TEMP_C"
 #include <stdio.h>
diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh
index 19a779cfa5..e1a9097b33 100644
--- a/qb/qb.libs.sh
+++ b/qb/qb.libs.sh
@@ -1,6 +1,13 @@
-MAKEFILE_DEFINES=''
 CONFIG_DEFINES=''
+INCLUDE_DIRS=''
+LIBRARY_DIRS=''
+MAKEFILE_DEFINES=''
+PKG_CONF_USED=''
 
+ASFLAGS="${ASFLAGS:-}"
+CFLAGS="${CFLAGS:-}"
+CXXFLAGS="${CXXFLAGS:-}"
+LDFLAGS="${LDFLAGS:-}"
 PREFIX="${PREFIX:-/usr/local}"
 SHARE_DIR="${SHARE_DIR:-${PREFIX}/share}"
 
diff --git a/qb/qb.make.sh b/qb/qb.make.sh
index 376f011c6f..702d5bd8c9 100644
--- a/qb/qb.make.sh
+++ b/qb/qb.make.sh
@@ -1,4 +1,5 @@
 # Creates config.mk and config.h.
+vars=''
 add_define MAKEFILE GLOBAL_CONFIG_DIR "$GLOBAL_CONFIG_DIR"
 set -- $(set | grep ^HAVE_)
 while [ $# -gt 0 ]; do
diff --git a/qb/qb.moc.sh b/qb/qb.moc.sh
index 48ec950989..97bade7a17 100644
--- a/qb/qb.moc.sh
+++ b/qb/qb.moc.sh
@@ -3,6 +3,8 @@
 TEMP_MOC=.moc.h
 TEMP_CPP=.moc.cpp
 
+MOC="${MOC:-}"
+
 # Checking for working moc
 cat << EOF > "$TEMP_MOC"
 #include <QTimeZone>
diff --git a/qb/qb.params.sh b/qb/qb.params.sh
index 01cf05e8eb..62f0a1487a 100644
--- a/qb/qb.params.sh
+++ b/qb/qb.params.sh
@@ -66,7 +66,9 @@ opt_exists() # $opt is returned if exists in OPTS
 }
 
 parse_input() # Parse stuff :V
-{	OPTS=; while read -r VAR _; do
+{	BUILD=''
+	OPTS=''
+	while read -r VAR _; do
 		TMPVAR="${VAR%=*}"
 		OPTS="$OPTS ${TMPVAR##HAVE_}"
 	done < 'qb/config.params.sh'
diff --git a/qb/qb.system.sh b/qb/qb.system.sh
index 68c258e35a..0d7fd597b8 100644
--- a/qb/qb.system.sh
+++ b/qb/qb.system.sh
@@ -1,4 +1,4 @@
-if [ -n "$CROSS_COMPILE" ]; then
+if [ -n "${CROSS_COMPILE:=}" ]; then
 	case "$CROSS_COMPILE" in
 		*'-mingw32'*) OS='Win32';;
 		*'-msdosdjgpp'*) OS='DOS';;