From 5b736bcfd60df943c87a10890b14680d479228f2 Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Sun, 29 Dec 2013 18:01:57 +0100
Subject: [PATCH] mkxp.pro: Shorten keyword lenght to choose binding

'BINDING=BINDING_MRI' => 'BINDING=MRI'

Also error out if multiple bindings are chosen.
---
 README.md |  6 ++---
 mkxp.pro  | 68 +++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 49 insertions(+), 25 deletions(-)

diff --git a/README.md b/README.md
index cc7a006..f82add6 100644
--- a/README.md
+++ b/README.md
@@ -50,11 +50,11 @@ qmake will use pkg-config to locate the respective include/library paths. If you
 
 The exception is boost, which is weird in that it still hasn't managed to pull off pkg-config support (seriously?). *If you installed boost in a non-standard prefix*, you will need to pass its include path via `BOOST_I` and library path via `BOOST_L`, either as direct arguments to qmake (`qmake BOOST_I="/usr/include" ...`) or via environment variables.
 
-**MRI-Binding**: pkg-config will look for `ruby-2.1.pc`, but you can modify mkxp.pro to use 2.0 instead. This is the default binding, so no arguments to qmake needed (`BINDING=BINDING_MRI` to be explicit).
+**MRI-Binding**: pkg-config will look for `ruby-2.1.pc`, but you can modify mkxp.pro to use 2.0 instead. This is the default binding, so no arguments to qmake needed (`BINDING=MRI` to be explicit).
 
-**MRuby-Binding**: place the "mruby" folder into the project folder and build it first. Add `BINDING=BINDING_MRUBY` to qmake's arguments.
+**MRuby-Binding**: place the "mruby" folder into the project folder and build it first. Add `BINDING=MRUBY` to qmake's arguments.
 
-**Null-Binding**: Add `BINDING=BINDING_NULL` to qmake's arguments.
+**Null-Binding**: Add `BINDING=NULL` to qmake's arguments.
 
 ### Supported image/audio formats
 These depend on the SDL auxiliary libraries. For maximum RGSS compliance, build SDL2_image with png/jpg support, and SDL_sound with oggvorbis/wav/mp3 support.
diff --git a/mkxp.pro b/mkxp.pro
index e5a0da3..b66a698 100644
--- a/mkxp.pro
+++ b/mkxp.pro
@@ -7,33 +7,38 @@ DEPENDPATH += src shader assets
 INCLUDEPATH += . src
 LIBS += -lGL
 
-# Deal with boost paths...
-isEmpty(BOOST_I) {
-	BOOST_I = $$(BOOST_I)
-}
-isEmpty(BOOST_I) {}
-else {
-	INCLUDEPATH += $$BOOST_I
-}
-
-isEmpty(BOOST_L) {
-	BOOST_L = $$(BOOST_L)
-}
-isEmpty(BOOST_L) {}
-else {
-	LIBS += -L$$BOOST_L
-}
-
-LIBS += -lboost_program_options
-
-
 CONFIG(release, debug|release): DEFINES += NDEBUG
 
 isEmpty(BINDING) {
-	BINDING = BINDING_MRI
+	BINDING = MRI
 }
 
-CONFIG += $$BINDING
+contains(BINDING, MRI) {
+	contains(_HAVE_BINDING, YES) {
+		error("Only one binding may be selected")
+	}
+	_HAVE_BINDING = YES
+
+	CONFIG += BINDING_MRI
+}
+
+contains(BINDING, MRUBY) {
+	contains(_HAVE_BINDING, YES) {
+		error("Only one binding may be selected")
+	}
+	_HAVE_BINDING = YES
+
+	CONFIG += BINDING_MRUBY
+}
+
+contains(BINDING, NULL) {
+	contains(_HAVE_BINDING, YES) {
+		error("Only one binding may be selected")
+	}
+	_HAVE_BINDING = YES
+
+	CONFIG += BINDING_NULL
+}
 
 RGSS2 {
 	DEFINES += RGSS2
@@ -47,6 +52,25 @@ unix {
 	RGSS2 {
 		PKGCONFIG += vorbisfile
 	}
+
+	# Deal with boost paths...
+	isEmpty(BOOST_I) {
+		BOOST_I = $$(BOOST_I)
+	}
+	isEmpty(BOOST_I) {}
+	else {
+		INCLUDEPATH += $$BOOST_I
+	}
+
+	isEmpty(BOOST_L) {
+		BOOST_L = $$(BOOST_L)
+	}
+	isEmpty(BOOST_L) {}
+	else {
+		LIBS += -L$$BOOST_L
+	}
+
+	LIBS += -lboost_program_options
 }
 
 # Input