summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-05-17 20:40:38 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-17 21:59:48 +0200
commit5babcac289d04a3c2f627dbbbd3e62718d3f98f3 (patch)
tree01b0b33edf0a1dcd4cbf239d3b70b74d0a5b5436
parent2d98f4e28f7e86feea595ef5e4ff8b32037b64e9 (diff)
downloadserenity-5babcac289d04a3c2f627dbbbd3e62718d3f98f3.zip
Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a CMakeToolchain.txt file that can be used to build arbitrary cmake-using applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when running cmake: -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
-rwxr-xr-xAK/install.sh4
-rwxr-xr-xKernel/install.sh4
-rwxr-xr-xKernel/makeall.sh7
-rwxr-xr-xKernel/sync.sh2
-rw-r--r--LibCore/Makefile9
-rwxr-xr-xLibCore/install.sh5
-rw-r--r--LibGUI/Makefile6
-rwxr-xr-xLibGUI/install.sh5
-rwxr-xr-xServers/WindowServer/install.sh4
-rwxr-xr-xSharedGraphics/install.sh4
-rw-r--r--Toolchain/CMakeToolchain.txt19
-rw-r--r--Toolchain/UseIt.sh1
12 files changed, 67 insertions, 3 deletions
diff --git a/AK/install.sh b/AK/install.sh
new file mode 100755
index 0000000000..d0827c7502
--- /dev/null
+++ b/AK/install.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+mkdir -p ../Root/usr/include/AK/
+cp ../AK/*.h ../Root/usr/include/AK/
diff --git a/Kernel/install.sh b/Kernel/install.sh
new file mode 100755
index 0000000000..46c09473b2
--- /dev/null
+++ b/Kernel/install.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+mkdir -p ../Root/usr/include/Kernel/
+cp *.h ../Root/usr/include/Kernel/
diff --git a/Kernel/makeall.sh b/Kernel/makeall.sh
index 0b599e8753..78f74ab407 100755
--- a/Kernel/makeall.sh
+++ b/Kernel/makeall.sh
@@ -33,6 +33,7 @@ build_targets="$build_targets ../Games/Snake"
build_targets="$build_targets ../Shell"
build_targets="$build_targets ../Demos/HelloWorld"
build_targets="$build_targets ../Demos/RetroFetch"
+build_targets="$build_targets ." # the kernel
for targ in $build_targets; do
echo "Building $targ"
@@ -45,7 +46,9 @@ for targ in $build_targets; do
fi
done
-$make_cmd clean
-$make_cmd
+# has no need to build separately, but install headers.
+(cd ../SharedGraphics && ./install.sh)
+(cd ../AK && ./install.sh)
+
sudo ./sync.sh
diff --git a/Kernel/sync.sh b/Kernel/sync.sh
index 391d2679f7..b548bcb283 100755
--- a/Kernel/sync.sh
+++ b/Kernel/sync.sh
@@ -6,7 +6,7 @@ fi
if [ $(id -u) != 0 ]; then
echo "This needs to be run as root"
- exit
+ exit 1
fi
rm -vf _fs_contents.lock
diff --git a/LibCore/Makefile b/LibCore/Makefile
index b75c137b1a..c86c210e03 100644
--- a/LibCore/Makefile
+++ b/LibCore/Makefile
@@ -36,3 +36,12 @@ $(LIBRARY): $(OBJS)
clean:
@echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d
+install: $(LIBRARY)
+ mkdir -p ../Root/usr/include/LibCore
+ mkdir -p ../Root/usr/include/AK
+ mkdir -p ../Root/usr/lib
+ # Copy headers
+ rsync -r -a --include '*/' --include '*.h' --exclude '*' . ../Root/usr/include/LibCore
+ rsync -r -a --include '*/' --include '*.h' --exclude '*' ../AK/ ../Root/usr/include/AK
+ # Install the library
+ cp $(LIBRARY) ../Root/usr/lib
diff --git a/LibCore/install.sh b/LibCore/install.sh
new file mode 100755
index 0000000000..fedc4b73fb
--- /dev/null
+++ b/LibCore/install.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+mkdir -p ../Root/usr/include/LibCore/
+cp *.h ../Root/usr/include/LibCore/
+cp libcore.a ../Root/usr/lib/
diff --git a/LibGUI/Makefile b/LibGUI/Makefile
index 766cc49db9..1039ff00a0 100644
--- a/LibGUI/Makefile
+++ b/LibGUI/Makefile
@@ -77,3 +77,9 @@ $(LIBRARY): $(OBJS)
clean:
@echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d
+install: $(LIBRARY)
+ mkdir -p ../Root/usr/include/LibGUI
+ # Copy headers
+ rsync -r -a --include '*/' --include '*.h' --exclude '*' . ../Root/usr/include/LibGUI
+ # Install the library
+ cp $(LIBRARY) ../Root/usr/lib
diff --git a/LibGUI/install.sh b/LibGUI/install.sh
new file mode 100755
index 0000000000..e3cf91fcd7
--- /dev/null
+++ b/LibGUI/install.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+mkdir -p ../Root/usr/include/LibGUI/
+cp *.h ../Root/usr/include/LibGUI/
+cp libgui.a ../Root/usr/lib/
diff --git a/Servers/WindowServer/install.sh b/Servers/WindowServer/install.sh
new file mode 100755
index 0000000000..27a3a583be
--- /dev/null
+++ b/Servers/WindowServer/install.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+mkdir -p ../../Root/usr/include/WindowServer/
+cp *.h ../../Root/usr/include/WindowServer/
diff --git a/SharedGraphics/install.sh b/SharedGraphics/install.sh
new file mode 100755
index 0000000000..5b19415f9d
--- /dev/null
+++ b/SharedGraphics/install.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+mkdir -p ../Root/usr/include/SharedGraphics/
+cp *.h ../Root/usr/include/SharedGraphics/
diff --git a/Toolchain/CMakeToolchain.txt b/Toolchain/CMakeToolchain.txt
new file mode 100644
index 0000000000..e826e46485
--- /dev/null
+++ b/Toolchain/CMakeToolchain.txt
@@ -0,0 +1,19 @@
+set(CMAKE_SYSTEM_NAME Generic)
+
+if (NOT DEFINED ENV{SERENITY_ROOT})
+ message(FATAL_ERROR "SERENITY_ROOT not set. Please source Toolchain/UseIt.sh.")
+endif()
+
+# where to read from/write to
+set(CMAKE_SYSROOT $ENV{SERENITY_ROOT}/Root)
+set(CMAKE_STAGING_PREFIX $ENV{SERENITY_ROOT}/Root)
+set(CMAKE_INSTALL_PREFIX $ENV{SERENITY_ROOT}/Root)
+
+set(CMAKE_C_COMPILER i686-pc-serenity-gcc)
+set(CMAKE_CXX_COMPILER i686-pc-serenity-g++)
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
diff --git a/Toolchain/UseIt.sh b/Toolchain/UseIt.sh
index 4008a23c73..4c53049ff0 100644
--- a/Toolchain/UseIt.sh
+++ b/Toolchain/UseIt.sh
@@ -2,4 +2,5 @@
DIR=$( dirname $( readlink -e "$0" ) )
export PATH="$DIR/Local/bin:$PATH"
export TOOLCHAIN="$DIR"
+export SERENITY_ROOT="$DIR/.."
echo "$PATH"