From 608729e0d6c17f7011aa4e669948fdcf9383deaa Mon Sep 17 00:00:00 2001
From: Bruce Cowan <bruce@bcowan.me.uk>
Date: Fri, 19 Aug 2016 00:25:03 +0100
Subject: [PATCH] Port to meson

---
 .gitignore                                        |  4 +---
 Makefile                                          | 14 --------------
 interface.ui => data/interface.ui                 |  0
 data/meson.build                                  |  0
 rugby.css => data/rugby.css                       |  0
 rugby.gresource.xml => data/rugby.gresource.xml   |  0
 meson.build                                       | 15 +++++++++++++++
 src/meson.build                                   | 14 ++++++++++++++
 rugby-application.c => src/rugby-application.c    |  0
 rugby-application.h => src/rugby-application.h    |  0
 .../rugby-cell-renderer-score.c                   |  0
 .../rugby-cell-renderer-score.h                   |  0
 rugby-score-store.c => src/rugby-score-store.c    |  0
 rugby-score-store.h => src/rugby-score-store.h    |  0
 rugby-scoring.c => src/rugby-scoring.c            |  2 +-
 rugby-scoring.h => src/rugby-scoring.h            |  0
 rugby.c => src/rugby.c                            |  0
 17 files changed, 31 insertions(+), 18 deletions(-)
 delete mode 100644 Makefile
 rename interface.ui => data/interface.ui (100%)
 create mode 100644 data/meson.build
 rename rugby.css => data/rugby.css (100%)
 rename rugby.gresource.xml => data/rugby.gresource.xml (100%)
 create mode 100644 meson.build
 create mode 100644 src/meson.build
 rename rugby-application.c => src/rugby-application.c (100%)
 rename rugby-application.h => src/rugby-application.h (100%)
 rename rugby-cell-renderer-score.c => src/rugby-cell-renderer-score.c (100%)
 rename rugby-cell-renderer-score.h => src/rugby-cell-renderer-score.h (100%)
 rename rugby-score-store.c => src/rugby-score-store.c (100%)
 rename rugby-score-store.h => src/rugby-score-store.h (100%)
 rename rugby-scoring.c => src/rugby-scoring.c (96%)
 rename rugby-scoring.h => src/rugby-scoring.h (100%)
 rename rugby.c => src/rugby.c (100%)

diff --git a/.gitignore b/.gitignore
index eb15d0b..378eac2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1 @@
-*.o
-rugby
-rugby-resources.c
+build
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f70a223..0000000
--- a/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-CFLAGS = -Wall `pkg-config --cflags gtk+-3.0`
-CPPFLAGS = -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4
-CPPFLAGS += -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
-LDLIBS = `pkg-config --libs gtk+-3.0`
-
-all: rugby
-
-rugby: rugby-application.o rugby-cell-renderer-score.o rugby-resources.o rugby-score-store.o rugby-scoring.o rugby.o
-
-rugby-resources.c: rugby.gresource.xml $(shell glib-compile-resources --generate-dependencies rugby.gresource.xml)
-	glib-compile-resources --generate-source rugby.gresource.xml --target $@
-
-clean:
-	$(RM) rugby *.o rugby-resources.c
diff --git a/interface.ui b/data/interface.ui
similarity index 100%
rename from interface.ui
rename to data/interface.ui
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..e69de29
diff --git a/rugby.css b/data/rugby.css
similarity index 100%
rename from rugby.css
rename to data/rugby.css
diff --git a/rugby.gresource.xml b/data/rugby.gresource.xml
similarity index 100%
rename from rugby.gresource.xml
rename to data/rugby.gresource.xml
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..75a31e6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,15 @@
+project('rugby', 'c',
+        default_options: [
+            'buildtype=debugoptimized',
+            'c_std=gnu11',
+            'warning_level=1'
+        ])
+
+add_global_arguments(['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38',
+                      '-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_10',
+                      '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38',
+                      '-DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_10'],
+                      language: 'c')
+
+subdir('src')
+subdir('data')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..a459bbd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,14 @@
+gnome = import('gnome')
+
+res = gnome.compile_resources('gen-resources', '../data/rugby.gresource.xml', source_dir: '../data')
+
+gtk = dependency('gtk+-3.0', version : '>= 3.10')
+
+src = ['rugby.c',
+       'rugby-application.c',
+       'rugby-cell-renderer-score.c',
+       'rugby-score-store.c',
+       'rugby-scoring.c',
+       res]
+
+executable('rugby', src, dependencies : gtk)
diff --git a/rugby-application.c b/src/rugby-application.c
similarity index 100%
rename from rugby-application.c
rename to src/rugby-application.c
diff --git a/rugby-application.h b/src/rugby-application.h
similarity index 100%
rename from rugby-application.h
rename to src/rugby-application.h
diff --git a/rugby-cell-renderer-score.c b/src/rugby-cell-renderer-score.c
similarity index 100%
rename from rugby-cell-renderer-score.c
rename to src/rugby-cell-renderer-score.c
diff --git a/rugby-cell-renderer-score.h b/src/rugby-cell-renderer-score.h
similarity index 100%
rename from rugby-cell-renderer-score.h
rename to src/rugby-cell-renderer-score.h
diff --git a/rugby-score-store.c b/src/rugby-score-store.c
similarity index 100%
rename from rugby-score-store.c
rename to src/rugby-score-store.c
diff --git a/rugby-score-store.h b/src/rugby-score-store.h
similarity index 100%
rename from rugby-score-store.h
rename to src/rugby-score-store.h
diff --git a/rugby-scoring.c b/src/rugby-scoring.c
similarity index 96%
rename from rugby-scoring.c
rename to src/rugby-scoring.c
index 014700a..920e9e2 100644
--- a/rugby-scoring.c
+++ b/src/rugby-scoring.c
@@ -4,7 +4,7 @@
  * rugby_scoring_get_possibilities:
  * @score: the score of a team
  *
- * Gets the possibile ways of scoring @score points, as a %GVariant of the
+ * Gets the possible ways of scoring @score points, as a %GVariant of the
  * type "a(iii)", in the order "tries, utries, pens".
  *
  * Returns: (transfer-none): the possibilities, or %NULL in the case there are
diff --git a/rugby-scoring.h b/src/rugby-scoring.h
similarity index 100%
rename from rugby-scoring.h
rename to src/rugby-scoring.h
diff --git a/rugby.c b/src/rugby.c
similarity index 100%
rename from rugby.c
rename to src/rugby.c
-- 
GitLab