diff options
| author | Miguel <m.i@gmx.at> | 2019-03-07 23:26:17 +0100 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2019-03-07 23:26:17 +0100 |
| commit | 52f86ea0075c66e18e4796ad88f45541da8b4de5 (patch) | |
| tree | a7dcdb140e49ca13ed2315970e3b86e0c6fb9ef3 /080_blog/00018_Building | |
| parent | a9e55a351753af1cfdeb75bdf50ecfd80de129c0 (diff) | |
some cleanup and such
Diffstat (limited to '080_blog/00018_Building')
| -rw-r--r-- | 080_blog/00018_Building/00030_The-Hell-of-Autotools/index.md | 74 | ||||
| -rw-r--r-- | 080_blog/00018_Building/00040_Various-notes-on-Building/index.md | 93 | ||||
| -rw-r--r-- | 080_blog/00018_Building/index.md | 3 |
3 files changed, 170 insertions, 0 deletions
diff --git a/080_blog/00018_Building/00030_The-Hell-of-Autotools/index.md b/080_blog/00018_Building/00030_The-Hell-of-Autotools/index.md new file mode 100644 index 0000000..746bd82 --- /dev/null +++ b/080_blog/00018_Building/00030_The-Hell-of-Autotools/index.md @@ -0,0 +1,74 @@ +The Hell of Autotools +===================== + March 19, 2018 +In this trivial example we compile a custom **webkit2gtk+ extension** with +**autotools**. For a start we need to provide two files, `Makefile.am` +and `configure.ac`, beside our actual `ext.c` source file, which contains +the extension code itself. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.c .numberLines} +// File: ext.c // + +#include <webkit2/webkit-web-extension.h> + +G_MODULE_EXPORT void +webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension, + GVariant *user_data) +{ + g_print("Hello Extension!\n"); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.makefile .numberLines} +# File: Makefile.am # + +webextension_LTLIBRARIES = libmyappwebextension.la +webextensiondir = /home/miguel/temp + +WEB_EXTENSION_CFLAGS = `pkg-config --cflags webkit2gtk-web-extension-4.0` +WEB_EXTENSION_LIBS2 = `pkg-config --libs webkit2gtk-web-extension-4.0` + +libmyappwebextension_la_SOURCES = ext.c +libmyappwebextension_la_CFLAGS = $(WEB_EXTENSION_CFLAGS) +libmyappwebextension_la_LIBADD = $(WEB_EXTENSION_LIBS) +libmyappwebextension_la_LDFLAGS = -module -avoid-version -no-undefined $(WEB_EXTENSION_LIBS2) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.makefile .numberLines} +# File: configure.ac # + +AC_PREREQ([2.69]) +AC_INIT(ext,0.1,test@example.com) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([ext.c]) +AC_PROG_CC +LT_INIT +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Put the above files in a new fresh directory and you are ready to see the +powers of autotools in action. + +Run the following commands on your pash prompt: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +touch NEWS README AUTHORS ChangeLog +aclocal +autoconf +automake --add-missing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +After this steps, we end up with 18 files in our directory. Finally we +can _configure_, _build_ and _install_ our extension. The following +commands will probably look familiar. Note that the _configure_ step +generates 6 additional files, totaling in **24 files** before the actual +_make_ command is run. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +./configure +make +make install +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... just to compile one **single C file**. diff --git a/080_blog/00018_Building/00040_Various-notes-on-Building/index.md b/080_blog/00018_Building/00040_Various-notes-on-Building/index.md new file mode 100644 index 0000000..0639063 --- /dev/null +++ b/080_blog/00018_Building/00040_Various-notes-on-Building/index.md @@ -0,0 +1,93 @@ +# Various Notes on Building + +## Webkit + +Let’s compile a release with debug info and install to /usr/local + +~~~~~~ {.bash} +wget https://webkitgtk.org/releases/webkitgtk-2.20.0.tar.xz +tar -xvf webkitgtk-2.20.0.tar.xz +cd webkitgtk-2.20.0 +# install all the libs that will be reported missing in the next step. +# I could not find the woff2 stuff in debian so skipped it... +cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_WOFF2=NO -GNinja +# this takes about 30minutes on my i7-4790K .. zzzzz..zzz +ninja +sudo ninja install +~~~~~~~~~~~ + + pkg-config + + pkg-config uses our new build now: + + [1] https://trac.webkit.org/wiki/BuildingGtk + [2] https://webkitgtk.org/ + +## GCC + +This is how I build gcc (5.2.0) and binutils (2.25.1). Check [5] first. + +* unpack binutils-x.y.z +* create a new directory binutils-x.y.z-build and inside it run the following commands: + +~~~~~~ {.bash} + $ ../binutils-x.y.z/configure --disable-nls --with-sysroot --enable-targets=all + $ make -j4 + $ make install +~~~~~~~~~~~~ + +* unpack gcc-x.y.z and run the contrib/download_prerequisites script inside. +* create a new directory: gcc-x.y.z-build and inside it run: + +~~~~~~ {.bash} + $ ../gcc-x.y.z/configure --disable-nls --enable-languages=c,c++ --enable-threads + $ make -j4 + $ make install +~~~~~~~~~~~~ + + REF: + + [1] binutils and gcc README files. + [2] https://gcc.gnu.org/install/ + [3] http://wiki.osdev.org/Building_GCC + [4] http://stackoverflow.com/questions/1726042/recipe-for-compiling-binutils-gcc-together + [5] https://gcc.gnu.org/install/prerequisites.html + +## Linux + + cd linux-source-[xxx] + make mrproper + cp someconfig .config -i + make oldconfig + make menuconfig + make localmodconfig + make localyesconfig + make + (OPT) make modules + su + make install + (OPT) make modules_install + (OPT) update-intiramfs -c -k [kernel-postfix] + + (REMOVE UNWANTED FILES FROM BOOT!) + update-grub + grub-install /dev/sda + reboot + + +## Clang + + http://llvm.org/releases/3.7.0/docs/CMake.html + http://clang.llvm.org/get_started.html + put MAKEFLAGS="-j8" or similar in front of your CMake invocations. + + extracted llvm to ~/temp/clang/llvm-3.7.0.src/ + extracted clang to ~/temp/clang/llvm-3.7.0.src/tools/clang/ + extracted compiler-rt to ~/temp/clang/llvm-3.7.0.src/projects/compiler-rt + extracted libcxx to ~/temp/clang/llvm-3.7.0.src/projects/libcxx + + $ cd ~/temp/clang/llvm-3.7.0-build + $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/miguel/opt/llvm-3.7.0 ../llvm-3.7.0.src + $ cmake --build . + $ cmake --build . --target install + diff --git a/080_blog/00018_Building/index.md b/080_blog/00018_Building/index.md new file mode 100644 index 0000000..1ee18e7 --- /dev/null +++ b/080_blog/00018_Building/index.md @@ -0,0 +1,3 @@ +# Building + +Some Random Notes about Building Software. |
