Skip to content

Instantly share code, notes, and snippets.

@cjpartridgeb
Created June 4, 2013 00:23
Show Gist options
  • Save cjpartridgeb/5702641 to your computer and use it in GitHub Desktop.
Save cjpartridgeb/5702641 to your computer and use it in GitHub Desktop.
building node-chimera on Ubuntu 12.04 Grab node-chimera master Grab phantomjs master Copy qt folder from phantomjs/src/qt to node-chimera/qt Run ./scripts/compile_openssl.sh Run ./scripts/compile_qt.sh Run ./scripts/compile_binary.sh Tested on two separate machines, both Ubuntu 12.04, on node 0.8.23 & node 0.10.9
{
'targets': [
{
'target_name': 'chimera',
'sources': [
'src/top.cc',
'src/cookiejar.cc',
'src/chimera.cc',
'src/browser.cc'
],
'conditions': [
['OS=="mac"', {
'include_dirs': [
'qt_compiled/include',
'qt_compiled/include/QtCore',
'qt_compiled/include/QtGui',
'qt_compiled/include/QtNetwork',
'qt_compiled/include/QtWebkit'
],
'libraries': [
'-framework AppKit',
'../qt_compiled/lib/libQtGui.a',
'../qt_compiled/lib/libQtCore.a',
'../qt_compiled/lib/libQtNetwork.a',
'../qt_compiled/lib/libQtWebKit.a',
'../qt_compiled/lib/libjscore.a',
'../qt_compiled/lib/libwebcore.a',
'../qt_compiled/lib/libQtXml.a'
],
}],
['OS=="linux"', {
'include_dirs': [
'qt_compiled/include',
'qt_compiled/include/QtCore',
'qt_compiled/include/QtGui',
'qt_compiled/include/QtNetwork',
'qt_compiled/include/QtWebKit'
],
'libraries': [
'../qt_compiled/lib/libQtCore.a',
'../qt_compiled/lib/libQtGui.a',
'../qt_compiled/lib/libQtXml.a',
'../qt_compiled/lib/libQtNetwork.a',
'../qt_compiled/lib/libQtWebKit.a',
'../qt_compiled/lib/libwebcore.a',
'../qt_compiled/lib/libjscore.a'
],
}]
]
}
]
}
#!/bin/sh
node-gyp rebuild
cd build
flock ./Release/linker.lock g++ -shared -pthread -rdynamic -m64 -Wl,-soname=chimera.node -o Release/obj.target/chimera.node -Wl,--start-group Release/obj.target/chimera/src/top.o Release/obj.target/chimera/src/cookiejar.o Release/obj.target/chimera/src/chimera.o Release/obj.target/chimera/src/browser.o -Wl,--end-group ../qt_compiled/lib/libQtXml.a ../qt_compiled/lib/libQtNetwork.a ../qt_compiled/lib/libQtWebKit.a ../qt_compiled/lib/libwebcore.a ../qt_compiled/lib/libjscore.a -Wl,--whole-archive ../qt_compiled/lib/libQtCore.a ../qt_compiled/lib/libQtGui.a -Wl,--no-whole-archive -Wl,-Bsymbolic /usr/lib/x86_64-linux-gnu/libfontconfig.so -Bstatic -L../openssl -lssl -lcrypto
make
cp Release/chimera.node ../lib
#!/usr/bin/env bash
cd qt
COMPILE_JOBS=4
QT_CFG=''
QT_CFG+=' -opensource' # Use the open-source license
QT_CFG+=' -confirm-license' # Silently acknowledge the license confirmation
QT_CFG+=' -v' # Makes it easier to see what header dependencies are missing
QT_CFG+=' -static'
if [[ $OSTYPE = darwin* ]]; then
QT_CFG+=' -arch x86'
QT_CFG+=' -cocoa' # Cocoa only, ignore Carbon
QT_CFG+=' -no-dwarf2'
else
QT_CFG+=' -system-freetype' # Freetype for text rendering
QT_CFG+=' -fontconfig' # Fontconfig for better font matching
QT_CFG+=' -qpa' # X11-less with QPA (aka Lighthouse)
fi
QT_CFG+=' -release' # Build only for release (no debugging support)
QT_CFG+=' -fast' # Accelerate Makefiles generation
QT_CFG+=' -nomake demos' # Don't build with the demos
QT_CFG+=' -nomake docs' # Don't generate the documentatio
QT_CFG+=' -nomake examples' # Don't build any examples
QT_CFG+=' -nomake translations' # Ignore the translations
QT_CFG+=' -nomake tools' # Don't built the tools
QT_CFG+=' -no-exceptions' # Don't use C++ exception
QT_CFG+=' -no-stl' # No need for STL compatibility
# Irrelevant Qt features
QT_CFG+=' -no-libmng'
QT_CFG+=' -no-libtiff'
QT_CFG+=' -no-icu'
# Unnecessary Qt modules
QT_CFG+=' -no-declarative'
QT_CFG+=' -no-multimedia'
QT_CFG+=' -no-opengl'
QT_CFG+=' -no-openvg'
QT_CFG+=' -no-phonon'
QT_CFG+=' -no-qt3support'
QT_CFG+=' -no-script'
QT_CFG+=' -no-scripttools'
QT_CFG+=' -no-svg'
QT_CFG+=' -no-xmlpatterns'
# Unnecessary Qt features
QT_CFG+=' -D QT_NO_GRAPHICSVIEW'
QT_CFG+=' -D QT_NO_GRAPHICSEFFECT'
# Sets the default graphics system to the raster engine
QT_CFG+=' -graphicssystem raster'
# Unix
QT_CFG+=' -no-dbus' # Disable D-Bus feature
QT_CFG+=' -no-glib' # No need for Glib integration
QT_CFG+=' -no-gstreamer' # Turn off GStreamer support
QT_CFG+=' -no-gtkstyle' # Disable theming integration with Gtk+
QT_CFG+=' -no-cups' # Disable CUPs support
QT_CFG+=' -no-sm'
QT_CFG+=' -no-xinerama'
QT_CFG+=' -no-xkb'
# Use the bundled libraries, vs system-installed
QT_CFG+=' -qt-libjpeg'
QT_CFG+=' -qt-libpng'
QT_CFG+=' -qt-zlib'
# Explicitly compile with SSL support, so build will fail if headers are missing
QT_CFG+=' -openssl-linked'
# Useless styles
QT_CFG+=' -D QT_NO_STYLESHEET'
QT_CFG+=' -D QT_NO_STYLE_CDE'
QT_CFG+=' -D QT_NO_STYLE_CLEANLOOKS'
QT_CFG+=' -D QT_NO_STYLE_MOTIF'
QT_CFG+=' -D QT_NO_STYLE_PLASTIQUE'
until [ -z "$1" ]; do
case $1 in
"--qt-config")
shift
QT_CFG+=" $1"
shift;;
"--jobs")
shift
COMPILE_JOBS=$1
shift;;
"--help")
echo "Usage: $0 [--qt-config CONFIG] [--jobs NUM]"
echo
echo " --qt-config CONFIG Specify extra config options to be used when configuring Qt"
echo " --jobs NUM How many parallel compile jobs to use. Defaults to 4."
echo
exit 0
;;
*)
echo "Unrecognised option: $1"
exit 1;;
esac
done
# For parallelizing the bootstrapping process, e.g. qmake and friends.
export MAKEFLAGS=-j$COMPILE_JOBS
export OPENSSL_LIBS='-L../openssl -lssl -lcrypto'
./configure -prefix ../qt_compiled $QT_CFG
make -j$COMPILE_JOBS install
cd src/3rdparty/webkit/Source/WebCore
make -j$COMPILE_JOBS
cd ../../../../..
cd src/3rdparty/webkit/Source/JavaScriptCore
make -j$COMPILE_JOBS
cd ../../../../..
cp -rp src/3rdparty/webkit/Source/JavaScriptCore/release/* ../qt_compiled/lib/
cp -rp src/3rdparty/webkit/Source/WebCore/release/* ../qt_compiled/lib/
cat include/QtGui/QtGui | grep -v -e 'qs60' -e 'qvfbhdr' -e 'qwsembedwidget' > ../qt_compiled/include/QtGui/QtGui
rm -rf ../qt_compiled/include/QtScript
rm -rf ../qt_compiled/include/QtWebKit
cd ../qt_compiled/include
ln -s ../../qt/include/QtScript .
ln -s ../../qt/include/QtWebKit .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment