$OpenBSD: patch-system_mk,v 1.12 2014/03/23 18:17:35 kili Exp $
--- system.mk.orig	Fri Jan  9 23:20:27 2009
+++ system.mk	Tue Mar 18 11:41:59 2014
@@ -8,7 +8,7 @@
 
 # Installation path prefix. Unless you know what you're doing, the default
 # of /usr/local is likely the correct choice.
-PREFIX=/usr/local
+#PREFIX=/usr/local
 
 # Unless you are creating a package conforming to some OS's standards, you
 # probably do not want to modify the following directories:
@@ -16,15 +16,16 @@ PREFIX=/usr/local
 # Main binaries
 BINDIR=$(PREFIX)/bin
 # Configuration .lua files
-ETCDIR=$(PREFIX)/etc/ion3
+ETCDIR=$(PREFIX)/share/examples/ion3
 # Some .lua files and ion-* shell scripts
 SHAREDIR=$(PREFIX)/share/ion3
 # Manual pages
-MANDIR=$(PREFIX)/share/man
+MANDIR=$(PREFIX)/man
 # Some documents
 DOCDIR=$(PREFIX)/share/doc/ion3
+EXAMPLEDIR=$(PREFIX)/share/examples/ion3
 # Nothing at the moment
-INCDIR=$(PREFIX)/include/ion3
+INCDIR=$(PREFIX)/include
 # Nothing at the moment
 LIBDIR=$(PREFIX)/lib
 # Modules
@@ -53,7 +54,7 @@ LOCALEDIR=$(PREFIX)/share/locale
 
 # Flags to link with libdl. Even if PRELOAD_MODULES=1, you may need this
 # setting (for e.g. Lua, when not instructed by pkg-config).
-DL_LIBS=-ldl
+#DL_LIBS=-ldl
 
 
 ##
@@ -63,17 +64,17 @@ DL_LIBS=-ldl
 # If you have installed Lua 5.1 from the official tarball without changing
 # paths, this should do it.
 LUA_DIR=/usr/local
-LUA_LIBS = -L$(LUA_DIR)/lib -llua
-LUA_INCLUDES = -I$(LUA_DIR)/include
-LUA=$(LUA_DIR)/bin/lua
-LUAC=$(LUA_DIR)/bin/luac
+#LUA_LIBS = -L$(LUA_DIR)/lib -llua
+#LUA_INCLUDES = -I$(LUA_DIR)/include
+#LUA=$(LUA_DIR)/bin/lua
+#LUAC=$(LUA_DIR)/bin/luac
 
 # If you are using the Debian packages, the following settings should be
 # what you want.
-#LUA_LIBS=`pkg-config --libs lua5.1`
-#LUA_INCLUDES=`pkg-config --cflags lua5.1`
-#LUA=/usr/bin/lua5.1
-#LUAC=/usr/bin/luac5.1
+LUA_LIBS=`pkg-config --libs lua51`
+LUA_INCLUDES=`pkg-config --cflags lua51`
+LUA=`which lua51`
+LUAC=`which luac51`
 
 
 ##
@@ -81,7 +82,7 @@ LUAC=$(LUA_DIR)/bin/luac
 ##
 
 # Paths
-X11_PREFIX=/usr/X11R6
+X11_PREFIX=$(X11BASE)
 # SunOS/Solaris
 #X11_PREFIX=/usr/openwin
 
@@ -114,6 +115,9 @@ DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
 
 # On some other systems you may need to explicitly link against libintl.
 #EXTRA_LIBS += -lintl
+EXTRA_LIBS += -L$(LOCALBASE)/lib -lintl -liconv
+EXTRA_INCLUDES += -I$(LOCALBASE)/include -I/usr/local/include/lua-5.1
+
 # You may also need to give the location of its headers. The following
 # should work on Mac OS X (which needs the above option as well) with
 # macports.
@@ -127,12 +131,12 @@ DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
 # You may uncomment this if you know that your system C libary provides
 # asprintf and  vasprintf. (GNU libc does.) If HAS_SYSTEM_ASPRINTF is not
 # defined, an implementation provided in libtu/sprintf_2.2/ is used. 
-#HAS_SYSTEM_ASPRINTF=1
+HAS_SYSTEM_ASPRINTF=1
 
 # The following setting is needed with GNU libc for clock_gettime and the
 # monotonic clock. Other systems may not need it, or may not provide a
 # monotonic clock at all (which Ion can live with, and usually detect).
-EXTRA_LIBS += -lrt
+#EXTRA_LIBS += -lrt
 
 # Cygwin needs this.
 #DEFINES += -DCF_NO_GETLOADAVG
@@ -149,16 +153,16 @@ EXTRA_LIBS += -lrt
 ## C compiler. 
 ##
 
-CC=gcc
+#CC=gcc
 
 # Same as '-Wall -pedantic' without '-Wunused' as callbacks often
 # have unused variables.
-WARN=	-W -Wimplicit -Wreturn-type -Wswitch -Wcomment \
-	-Wtrigraphs -Wformat -Wchar-subscripts \
-	-Wparentheses -pedantic -Wuninitialized
+#WARN=	-W -Wimplicit -Wreturn-type -Wswitch -Wcomment \
+#	-Wtrigraphs -Wformat -Wchar-subscripts \
+#	-Wparentheses -pedantic -Wuninitialized
 
-CFLAGS=-Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES)
-LDFLAGS=$(LIBS) $(EXTRA_LIBS)
+CFLAGS+= $(WARN) $(DEFINES) $(EXTRA_INCLUDES) $(INCLUDES)
+LDFLAGS+= $(EXTRA_LIBS) $(LIBS)
 EXPORT_DYNAMIC=-Xlinker --export-dynamic
 
 # The following options are mainly for development use and can be used
