mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 09:51:36 +03:00
89 lines
2.3 KiB
Bash
89 lines
2.3 KiB
Bash
|
source $setup
|
||
|
|
||
|
examples=$qtbase/src/examples
|
||
|
|
||
|
mkdir build
|
||
|
cd build
|
||
|
mkdir bin moc obj
|
||
|
|
||
|
cat > obj/plugins.cpp <<EOF
|
||
|
#include <QtPlugin>
|
||
|
#ifdef _WIN32
|
||
|
Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin);
|
||
|
#endif
|
||
|
#ifdef __linux__
|
||
|
Q_IMPORT_PLUGIN (QLinuxFbIntegrationPlugin);
|
||
|
Q_IMPORT_PLUGIN (QXcbIntegrationPlugin);
|
||
|
#endif
|
||
|
EOF
|
||
|
|
||
|
CFLAGS="-std=gnu++11"
|
||
|
|
||
|
echo "compiling reference to plugins"
|
||
|
$host-g++ $CFLAGS \
|
||
|
$(pkg-config-cross --cflags Qt5Core) \
|
||
|
-c obj/plugins.cpp \
|
||
|
-o obj/plugins.o
|
||
|
|
||
|
CFLAGS="$CFLAGS -g -I. $(pkg-config-cross --cflags Qt5Widgets)"
|
||
|
LIBS="$(pkg-config-cross --libs Qt5Widgets)"
|
||
|
LDFLAGS=""
|
||
|
|
||
|
if [ $os = "windows" ]; then
|
||
|
CFLAGS="-mwindows $CFLAGS"
|
||
|
fi
|
||
|
|
||
|
echo "compiling dynamiclayouts"
|
||
|
$qtbase/bin/moc $examples/widgets/layouts/dynamiclayouts/dialog.h > moc/dynamiclayouts.cpp
|
||
|
$host-g++ $CFLAGS $LDFLAGS \
|
||
|
$examples/widgets/layouts/dynamiclayouts/dialog.cpp \
|
||
|
$examples/widgets/layouts/dynamiclayouts/main.cpp \
|
||
|
moc/dynamiclayouts.cpp \
|
||
|
obj/plugins.o \
|
||
|
$LIBS -o bin/dynamiclayouts$exe_suffix
|
||
|
|
||
|
echo "compiling rasterwindow"
|
||
|
$qtbase/bin/moc $examples/gui/rasterwindow/rasterwindow.h > moc/rasterwindow.cpp
|
||
|
$host-g++ $CFLAGS $LDFLAGS \
|
||
|
$examples/gui/rasterwindow/rasterwindow.cpp \
|
||
|
$examples/gui/rasterwindow/main.cpp \
|
||
|
moc/rasterwindow.cpp \
|
||
|
obj/plugins.o \
|
||
|
$LIBS -o bin/rasterwindow$exe_suffix
|
||
|
|
||
|
echo "compiling analogclock"
|
||
|
$host-g++ $CFLAGS $LDFLAGS \
|
||
|
-I$examples/gui/rasterwindow/ \
|
||
|
$examples/gui/analogclock/main.cpp \
|
||
|
$examples/gui/rasterwindow/rasterwindow.cpp \
|
||
|
moc/rasterwindow.cpp \
|
||
|
obj/plugins.o \
|
||
|
$LIBS -o bin/analogclock$exe_suffix
|
||
|
|
||
|
# We haven't gotten OpenGL support to work on Linux yet (TODO)
|
||
|
if [ $os != "linux" ]; then
|
||
|
echo "compiling openglwindow"
|
||
|
$qtbase/bin/moc $examples/gui/openglwindow/openglwindow.h > moc/openglwindow.cpp
|
||
|
$host-g++ $CFLAGS $LDFLAGS \
|
||
|
$examples/gui/openglwindow/main.cpp \
|
||
|
$examples/gui/openglwindow/openglwindow.cpp \
|
||
|
moc/openglwindow.cpp \
|
||
|
obj/plugins.o \
|
||
|
$LIBS -o bin/openglwindow$exe_suffix
|
||
|
fi
|
||
|
|
||
|
# TODO: try to compile some stuff with $qtbase/bin/qmake too, make sure that works
|
||
|
|
||
|
mkdir -p $out/bin
|
||
|
|
||
|
for prog in analogclock dynamiclayouts openglwindow rasterwindow; do
|
||
|
if [ -f bin/$prog ]; then
|
||
|
$host-strip bin/$prog
|
||
|
cp bin/$prog $out/bin/
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
if [ $os = "linux" ]; then
|
||
|
cp $dejavu/ttf/DejaVuSans.ttf $out/bin/
|
||
|
fi
|