2013-01-05 15:15:15 +04:00
|
|
|
#!/usr/bin/env bash
|
2012-03-07 07:01:24 +04:00
|
|
|
|
2012-06-07 12:38:48 +04:00
|
|
|
set -e
|
|
|
|
|
2012-04-16 05:21:02 +04:00
|
|
|
COMPILE_JOBS=1
|
2012-06-17 01:21:28 +04:00
|
|
|
MAKEFLAGS_JOBS=''
|
|
|
|
|
|
|
|
if [[ "$MAKEFLAGS" != "" ]]; then
|
|
|
|
MAKEFLAGS_JOBS=$(echo $MAKEFLAGS | egrep -o '\-j[0-9]+' | egrep -o '[0-9]+')
|
|
|
|
fi
|
2012-04-16 05:21:02 +04:00
|
|
|
|
2012-04-18 16:16:27 +04:00
|
|
|
if [[ "$MAKEFLAGS_JOBS" != "" ]]; then
|
|
|
|
# user defined number of jobs in MAKEFLAGS, re-use that number
|
|
|
|
COMPILE_JOBS=$MAKEFLAGS_JOBS
|
|
|
|
elif [[ $OSTYPE = darwin* ]]; then
|
2012-04-16 05:21:02 +04:00
|
|
|
# We only support modern Mac machines, they are at least using
|
|
|
|
# hyperthreaded dual-core CPU.
|
|
|
|
COMPILE_JOBS=4
|
2014-07-24 21:25:46 +04:00
|
|
|
elif [[ $OSTYPE == freebsd* ]]; then
|
2013-01-05 15:37:20 +04:00
|
|
|
COMPILE_JOBS=`sysctl -n hw.ncpu`
|
2012-04-16 05:21:02 +04:00
|
|
|
else
|
|
|
|
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
|
|
|
|
if [[ "$CPU_CORES" -gt 1 ]]; then
|
|
|
|
COMPILE_JOBS=$CPU_CORES
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-01-05 15:37:20 +04:00
|
|
|
if [[ "$COMPILE_JOBS" -gt 8 ]]; then
|
|
|
|
# Safety net.
|
|
|
|
COMPILE_JOBS=8
|
|
|
|
fi
|
|
|
|
|
More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.
* On Darwin, by default, fontconfig is disabled and all of the other
libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
freetype, libpng, libjpeg, and zlib are used. Harfbuzz, pcre, and sqlite
continue to be bundled.
* Individual libraries from the above list may now be enabled or disabled
on the build.sh command line with e.g. --freetype=system or
--freetype=bundled.
* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
respectively. New option --qtdeps=bundled forces all available
bundled libraries to be used.
Also:
* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
sqlite comes from the system).
2014-08-29 01:04:52 +04:00
|
|
|
SILENT=
|
2014-01-07 06:45:59 +04:00
|
|
|
|
More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.
* On Darwin, by default, fontconfig is disabled and all of the other
libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
freetype, libpng, libjpeg, and zlib are used. Harfbuzz, pcre, and sqlite
continue to be bundled.
* Individual libraries from the above list may now be enabled or disabled
on the build.sh command line with e.g. --freetype=system or
--freetype=bundled.
* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
respectively. New option --qtdeps=bundled forces all available
bundled libraries to be used.
Also:
* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
sqlite comes from the system).
2014-08-29 01:04:52 +04:00
|
|
|
until [[ -z "$1" ]]; do
|
2012-03-07 07:01:24 +04:00
|
|
|
case $1 in
|
More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.
* On Darwin, by default, fontconfig is disabled and all of the other
libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
freetype, libpng, libjpeg, and zlib are used. Harfbuzz, pcre, and sqlite
continue to be bundled.
* Individual libraries from the above list may now be enabled or disabled
on the build.sh command line with e.g. --freetype=system or
--freetype=bundled.
* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
respectively. New option --qtdeps=bundled forces all available
bundled libraries to be used.
Also:
* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
sqlite comes from the system).
2014-08-29 01:04:52 +04:00
|
|
|
(--qmake-args)
|
2012-06-18 23:15:15 +04:00
|
|
|
shift
|
|
|
|
QMAKE_ARGS=$1
|
|
|
|
shift;;
|
More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.
* On Darwin, by default, fontconfig is disabled and all of the other
libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
freetype, libpng, libjpeg, and zlib are used. Harfbuzz, pcre, and sqlite
continue to be bundled.
* Individual libraries from the above list may now be enabled or disabled
on the build.sh command line with e.g. --freetype=system or
--freetype=bundled.
* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
respectively. New option --qtdeps=bundled forces all available
bundled libraries to be used.
Also:
* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
sqlite comes from the system).
2014-08-29 01:04:52 +04:00
|
|
|
(--jobs)
|
2012-03-07 07:01:24 +04:00
|
|
|
shift
|
|
|
|
COMPILE_JOBS=$1
|
|
|
|
shift;;
|
More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.
* On Darwin, by default, fontconfig is disabled and all of the other
libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
freetype, libpng, libjpeg, and zlib are used. Harfbuzz, pcre, and sqlite
continue to be bundled.
* Individual libraries from the above list may now be enabled or disabled
on the build.sh command line with e.g. --freetype=system or
--freetype=bundled.
* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
respectively. New option --qtdeps=bundled forces all available
bundled libraries to be used.
Also:
* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
sqlite comes from the system).
2014-08-29 01:04:52 +04:00
|
|
|
(--silent)
|
2014-08-14 16:35:45 +04:00
|
|
|
SILENT=silent
|
2014-01-07 06:45:59 +04:00
|
|
|
shift;;
|
More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.
* On Darwin, by default, fontconfig is disabled and all of the other
libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
freetype, libpng, libjpeg, and zlib are used. Harfbuzz, pcre, and sqlite
continue to be bundled.
* Individual libraries from the above list may now be enabled or disabled
on the build.sh command line with e.g. --freetype=system or
--freetype=bundled.
* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
respectively. New option --qtdeps=bundled forces all available
bundled libraries to be used.
Also:
* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
sqlite comes from the system).
2014-08-29 01:04:52 +04:00
|
|
|
|
2012-03-07 07:01:24 +04:00
|
|
|
"--help")
|
2014-08-18 22:17:22 +04:00
|
|
|
cat <<EOF
|
2015-02-15 12:39:07 +03:00
|
|
|
Usage: $0 [--jobs NUM]
|
2014-08-18 22:17:22 +04:00
|
|
|
|
|
|
|
--silent Produce less verbose output.
|
|
|
|
--jobs NUM How many parallel compile jobs to use.
|
|
|
|
Defaults to the number of CPU cores you have,
|
|
|
|
with a maximum of 8.
|
|
|
|
EOF
|
2012-03-07 07:01:24 +04:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
2014-08-18 19:28:25 +04:00
|
|
|
echo "Unrecognised option: $1" >&2
|
2012-03-07 07:01:24 +04:00
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2014-01-07 06:45:59 +04:00
|
|
|
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
|
|
|
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|
|
|
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
|
|
|
|
|
|
|
echo "System architecture... ($UNAME_SYSTEM $UNAME_RELEASE $UNAME_MACHINE)"
|
|
|
|
|
2015-02-15 12:39:07 +03:00
|
|
|
export QMAKE=qmake
|
|
|
|
# some Linux distros (e.g. Debian) allow you to parallel-install
|
|
|
|
# Qt4 and Qt5, using this environment variable to declare which
|
|
|
|
# one you want
|
|
|
|
export QT_SELECT=qt5
|
2014-01-07 06:45:59 +04:00
|
|
|
|
2014-08-14 16:35:45 +04:00
|
|
|
echo
|
|
|
|
echo "Building main PhantomJS application..."
|
2014-01-07 06:45:59 +04:00
|
|
|
echo
|
2014-08-14 04:24:51 +04:00
|
|
|
$QMAKE $QMAKE_ARGS
|
|
|
|
make -j$COMPILE_JOBS
|