$OpenBSD: patch-Makefile,v 1.2 2007/07/04 17:39:08 ajacoutot Exp $
--- Makefile.orig	Sun Jul  1 17:05:57 2007
+++ Makefile	Wed Jul  4 11:30:34 2007
@@ -18,7 +18,6 @@ VER_DATE=`date +"%Y-%m-%d"`
 
 # Where to install things:
 
-PREFIX=/usr/local
 
 
 # Root directory to place files when creating packages.
@@ -40,16 +39,12 @@ DATA_PREFIX=$(PKG_ROOT)$(PREFIX)/share/tuxpaint
 # Docs and man page:
 
 DOC_PREFIX=$(PKG_ROOT)$(PREFIX)/share/doc/tuxpaint
-MAN_PREFIX=$(PKG_ROOT)$(PREFIX)/share/man
+MAN_PREFIX=$(PKG_ROOT)$(PREFIX)/man
 
 
 # 'System-wide' Config file:
 
-ifeq ($(PREFIX),/usr)
-  CONFDIR=$(PKG_ROOT)/etc/tuxpaint
-else
-  CONFDIR=$(PKG_ROOT)$(PREFIX)/etc/tuxpaint
-endif
+CONFDIR=${SYSCONFDIR}/tuxpaint
 
 
 # Commands useful to other arch's (e.g., BeOS)
@@ -104,11 +99,11 @@ SDL_CFLAGS=$(shell sdl-config --cflags) $(SVG_CFLAGS)
 
 
 SVG_LIB=-lrsvg-2 -lcairo
-SVG_CFLAGS=-I/usr/include/librsvg-2/librsvg \
-	-I/usr/include/gtk-2.0 \
-	-I/usr/include/glib-2.0 \
-	-I/usr/lib/glib-2.0/include \
-	-I/usr/include/cairo
+SVG_CFLAGS=-I${LOCALBASE}/include/librsvg-2/librsvg \
+	-I${LOCALBASE}/include/gtk-2.0 \
+	-I${LOCALBASE}/include/glib-2.0 \
+	-I${LOCALBASE}/lib/glib-2.0/include \
+	-I${LOCALBASE}/include/cairo
 
 PAPER_LIB=-lpaper
 
@@ -116,8 +111,9 @@ PAPER_LIB=-lpaper
 # The entire set of CFLAGS:
 
 #-ffast-math
-OPTFLAGS=-O2
-CFLAGS=$(OPTFLAGS) -W -Wall -fno-common -ffloat-store \
+OPTFLAGS=
+CFLAGS+=-I${LOCALBASE}/include -I${LOCALBASE}/include/libpng \
+	$(OPTFLAGS) -W -Wall -fno-common -ffloat-store \
 	-Wcast-align -Wredundant-decls \
 	-Wbad-function-cast -Wwrite-strings \
 	-Waggregate-return \
@@ -142,19 +138,6 @@ MOUSE_CFLAGS=-Isrc/$(MOUSEDIR) -D$(CURSOR_SHAPES)_CURS
 # "make" with no arguments builds the program and man page from sources:
 
 all:	tuxpaint translations
-	@echo
-	@echo "--------------------------------------------------------------"
-	@echo
-	@echo "Done compiling."
-	@echo
-	@echo "Now run 'make install' with any options you ran 'make' with."
-	@echo "to install Tux Paint."
-	@echo
-	@echo "You may need superuser ('root') priveleges, depending on"
-	@echo "where you're installing."
-	@echo "(Depending on your system, you either need to 'su' first,"
-	@echo "or run 'sudo make install'.)"
-	@echo
 
 releaseclean:
 	@echo
@@ -286,24 +269,7 @@ include Makefile-i18n
 install:	install-bin install-data install-man install-doc \
 		install-icon install-gettext install-im install-importscript \
 		install-default-config install-example-stamps \
-		install-example-starters \
-		install-gnome install-kde install-kde-icons
-	@echo
-	@echo "--------------------------------------------------------------"
-	@echo
-	@echo "All done! Now (preferably NOT as 'root' superuser),"
-	@echo "you can type the command 'tuxpaint' to run the program!!!"
-	@echo
-	@echo "For more information, see the 'tuxpaint' man page,"
-	@echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)/README.txt"
-	@echo
-	@echo "Visit Tux Paint's home page for more information, updates"
-	@echo "and to learn how you can help out!"
-	@echo
-	@echo "  http://www.tuxpaint.org/"
-	@echo
-	@echo "Enjoy!"
-	@echo
+		install-example-starters
 
 
 # Installs the various parts for the MinGW/MSYS development/testing environment.
@@ -478,9 +444,8 @@ uninstall:	uninstall-i18n
 install-default-config:
 	@echo
 	@echo "...Installing default config file..."
-	@install -d $(CONFDIR)
-	@cp src/tuxpaint.conf $(CONFDIR)
-	@chmod 644 $(CONFDIR)/tuxpaint.conf
+	${BSD_INSTALL_DATA_DIR} $(PKG_ROOT)$(PREFIX)/share/examples/tuxpaint
+	${BSD_INSTALL_DATA} src/tuxpaint.conf $(PKG_ROOT)$(PREFIX)/share/examples/tuxpaint
 
 
 # Install example stamps
@@ -488,7 +453,7 @@ install-default-config:
 install-example-stamps:
 	@echo
 	@echo "...Installing example stamps..."
-	@install -d $(DATA_PREFIX)/stamps
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)/stamps
 	@cp -R stamps/* $(DATA_PREFIX)/stamps
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)/stamps
 
@@ -498,7 +463,7 @@ install-example-stamps:
 install-example-starters:
 	@echo
 	@echo "...Installing example starter images..."
-	@install -d $(DATA_PREFIX)/starters
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)/starters
 	@cp -R starters/* $(DATA_PREFIX)/starters
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)/starters
 
@@ -605,12 +570,9 @@ install-kde-icons:
 install-icon:
 	@echo
 	@echo "...Installing launcher icon graphics..."
-	@install -d $(ICON_PREFIX)
-	@cp data/images/icon.png $(ICON_PREFIX)/tuxpaint.png
-	@chmod 644 $(ICON_PREFIX)/tuxpaint.png
-	@install -d $(X11_ICON_PREFIX)
-	@cp data/images/icon32x32.xpm $(X11_ICON_PREFIX)/tuxpaint.xpm
-	@chmod 644 $(X11_ICON_PREFIX)/tuxpaint.xpm
+	${BSD_INSTALL_DATA_DIR} $(ICON_PREFIX)
+	${BSD_INSTALL_DATA} data/images/icon.png $(ICON_PREFIX)/tuxpaint.png
+	${BSD_INSTALL_DATA} data/images/icon32x32.xpm $(ICON_PREFIX)/tuxpaint.xpm
 
 
 # Install the program:
@@ -618,9 +580,7 @@ install-icon:
 install-bin:
 	@echo
 	@echo "...Installing program itself..."
-	@install -d $(BIN_PREFIX)
-	@cp tuxpaint $(BIN_PREFIX)
-	@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint$(EXE_EXT)
+	${BSD_INSTALL_PROGRAM} tuxpaint $(BIN_PREFIX)
 
 # Install the required Windows DLLs into the 'bdist' directory
 
@@ -652,8 +612,7 @@ install-dlls:
 install-importscript:
 	@echo
 	@echo "...Installing 'tuxpaint-import' script..."
-	@cp src/tuxpaint-import.sh $(BIN_PREFIX)/tuxpaint-import
-	@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint-import
+	${BSD_INSTALL_SCRIPT} src/tuxpaint-import.sh $(BIN_PREFIX)/tuxpaint-import
 
 
 # Install the data (sound, graphics, fonts):
@@ -661,12 +620,14 @@ install-importscript:
 install-data:
 	@echo
 	@echo "...Installing data files..."
-	@install -d $(DATA_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)
 	@cp -R data/* $(DATA_PREFIX)
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(PREFIX)/share/appplications
+	${BSD_INSTALL_DATA} src/tuxpaint.desktop $(PREFIX)/share/appplications
 	@echo
 	@echo "...Installing fonts..."
-	@install -d $(DATA_PREFIX)/fonts/locale
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)/fonts/locale
 	@cp -R fonts/locale/* $(DATA_PREFIX)/fonts/locale
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)/fonts/locale
 
@@ -677,9 +638,12 @@ install-data:
 install-doc:
 	@echo
 	@echo "...Installing documentation..."
-	@install -d $(DOC_PREFIX)
-	@cp -R docs/* $(DOC_PREFIX)
-	@chmod a=rX,g=rX,u=rwX $(DOC_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/ADVANCED-STAMPS-HOWTO.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/EXTENDING.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/FAQ.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/OPTIONS.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/README.txt $(DOC_PREFIX)
 
 
 # Install the man page:
@@ -688,21 +652,11 @@ install-man:
 	@echo
 	@echo "...Installing man pages..."
 	@# man1 directory...
-	@install -d $(MAN_PREFIX)/man1
+	${BSD_INSTALL_MAN_DIR} $(MAN_PREFIX)/man1
 	@# tuxpaint.1
-	@cp src/manpage/tuxpaint.1 $(MAN_PREFIX)/man1
-	@gzip -f $(MAN_PREFIX)/man1/tuxpaint.1
-	@chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tuxpaint.1.gz
-	@# pl/man1 directory...
-	@install -d $(MAN_PREFIX)/pl/man1/
-	@# tuxpaint-pl.1
-	@cp src/manpage/tuxpaint-pl.1 $(MAN_PREFIX)/pl/man1/tuxpaint.1
-	@gzip -f $(MAN_PREFIX)/pl/man1/tuxpaint.1
-	@chmod a+rx,g-w,o-w $(MAN_PREFIX)/pl/man1/tuxpaint.1.gz
+	${BSD_INSTALL_MAN} src/manpage/tuxpaint.1 $(MAN_PREFIX)/man1
 	@# tuxpaint-import.1
-	@cp src/manpage/tuxpaint-import.1 $(MAN_PREFIX)/man1/
-	@gzip -f $(MAN_PREFIX)/man1/tuxpaint-import.1
-	@chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tuxpaint-import.1.gz
+	${BSD_INSTALL_MAN} src/manpage/tuxpaint-import.1 $(MAN_PREFIX)/man1
 
 
 
@@ -723,7 +677,7 @@ tuxpaint:	obj/tuxpaint.o obj/i18n.o obj/im.o obj/curso
 		$(SDL_LIBS) \
 		$(SVG_LIB) \
 		$(PAPER_LIB) \
-		-lm $(ARCH_LINKS)
+		-lm $(ARCH_LINKS) -liconv -lintl -lutf8
 	@$(RSRC_CMD)
 	@$(MIMESET_CMD)
 
@@ -848,7 +802,7 @@ obj/postscript_print.o:	src/postscript_print.c obj \
 			src/postscript_print.h src/debug.h
 	@echo
 	@echo "...Compiling PostScript print support..."
-	@$(CC) $(CFLGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
+	@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
 		-c src/postscript_print.c -o obj/postscript_print.o
 
 obj/resource.o:	visualc/resources.rc obj visualc/resource.h
