diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Getting-meson.md | 9 | ||||
-rw-r--r-- | docs/markdown/Tutorial.md | 50 | ||||
-rw-r--r-- | docs/markdown/snippets/thinlto.md | 27 |
3 files changed, 45 insertions, 41 deletions
diff --git a/docs/markdown/Getting-meson.md b/docs/markdown/Getting-meson.md index e0e5722..3568dfc 100644 --- a/docs/markdown/Getting-meson.md +++ b/docs/markdown/Getting-meson.md @@ -23,12 +23,17 @@ a pull-request process that runs CI and tests several platforms. ## Installing Meson with pip Meson is available in the [Python Package Index] and can be installed with -`pip3 install meson` which requires root and will install it system-wide. +`sudo pip3 install meson` which requires root and will install it system-wide. + +If you have downloaded a copy of the meson sources already, you can install it +with `sudo pip3 install path/to/source/root/`. Alternatively, you can use `pip3 install --user meson` which will install it for your user and does not require any special privileges. This will install the package in `~/.local/`, so you will have to add `~/.local/bin` to your -`PATH`. +`PATH`, and `sudo meson install` will be completely broken since the +program will not be available to root. Only use a user copy of meson if you +do not care about installing projects as root. ## Installing Meson and Ninja with the MSI installer diff --git a/docs/markdown/Tutorial.md b/docs/markdown/Tutorial.md index bf337ba..85e345a 100644 --- a/docs/markdown/Tutorial.md +++ b/docs/markdown/Tutorial.md @@ -29,8 +29,11 @@ example. First we create a file `main.c` which holds the source. It looks like this. ```c -#include<stdio.h> +#include <stdio.h> +// +// main is where all program execution starts +// int main(int argc, char **argv) { printf("Hello there.\n"); return 0; @@ -53,7 +56,7 @@ to initialize the build by going into the source directory and issuing the following commands. ```console -$ meson builddir +$ meson setup builddir ``` We create a separate build directory to hold all of the compiler @@ -110,17 +113,40 @@ create a graphical window instead. We'll use the use GTK+. The new version looks like this. ```c -#include<gtk/gtk.h> -int main(int argc, char **argv) { - GtkWidget *win; - gtk_init(&argc, &argv); - win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(win), "Hello there"); - g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL); - gtk_widget_show(win); - gtk_main(); -} +#include <gtk/gtk.h> + +// +// Should provided the active view for a GTK application +// +static void activate(GtkApplication* app, gpointer user_data) +{ + GtkWidget *window; + GtkWidget *label; + + window = gtk_application_window_new (app); + label = gtk_label_new("Hello GNOME!"); + gtk_container_add (GTK_CONTAINER (window), label); + gtk_window_set_title(GTK_WINDOW (window), "Welcome to GNOME"); + gtk_window_set_default_size(GTK_WINDOW (window), 200, 100); + gtk_widget_show_all(window); +} // end of function activate + +// +// main is where all program execution starts +// +int main(int argc, char **argv) +{ + GtkApplication *app; + int status; + + app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE); + g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); + status = g_application_run(G_APPLICATION(app), argc, argv); + g_object_unref(app); + + return status; +} // end of function main ``` Then we edit the Meson file, instructing it to find and use the GTK+ diff --git a/docs/markdown/snippets/thinlto.md b/docs/markdown/snippets/thinlto.md deleted file mode 100644 index 44bc972..0000000 --- a/docs/markdown/snippets/thinlto.md +++ /dev/null @@ -1,27 +0,0 @@ -## Add support for thin LTO - -The `b_lto` option has been updated and now can be set to the value -`thin`. This enables [thin -LTO](https://clang.llvm.org/docs/ThinLTO.html) on all compilers where -it is supported. At the time of writing this means only Clang. - -This change is potentially backwards incompatible. If you have -examined the value of `b_lto` in your build file, note that its type -has changed from a boolean to a string. Thus comparisons like this: - -```meson -if get_option('b_lto') -... -endif -``` - -need to be changed to something like this instead: - -```meson -if get_option('b_lto') == 'true' -... -endif -``` - -This should not affect any command line invocations as configuring LTO -with `-Db_lto=true` still works and behaves the same way as before. |