From 517295ea0928dfd2bd30d997949c472f68d22e06 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 5 Apr 2005 01:01:58 +0000 Subject: Implemented install --- INSTALL | 38 ++++++++++++++++++++++++++++++++++++-- src/GNUmakefile | 11 +++++++---- src/install.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/test/GNUmakefile | 6 +++--- 4 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 src/install.sh diff --git a/INSTALL b/INSTALL index 2b7ae66..849c57e 100644 --- a/INSTALL +++ b/INSTALL @@ -1,10 +1,44 @@ This library is geared towards being compiled with MINGW, using MSYS and GNU Make. -Feel free to try it with other environments, but YMMV. +It builds OK, but has only been basically tested under Cygwin. There is +certainly no reason why it shouldn't work properly under Cygwin though. +To build: +1. 'cd src'. +2. Edit GNUmakefile and edit the following variables as required: + + INSTALLDIR This is the directory in which the headers and + library will be installed as $INSTALLDIR/include + and $INSTALLDIR/lib. The default is /usr/local, but + if you're going to use it ouside MSYS/Cygwin set a + DOS path, but use *forward* slashes. + + CREATECONF If set to 1 then this creates a w32dlib-config + shell script. This is always installed into + /usr/local/bin (as you have a proper shell, I + assume your using either MSYS or Cygwin). If not + edit install.sh accordingly. + + DEBUG Uncomment this line if you want a debug (-g) build + that also sends some rudementary output to the + Windows API OutputDebugString(). + +3. Type 'make'. + +4. If OK, 'cd test' and 'make' again. Run w32dtest.exe and make sure it + looks like it's not going to fall over in a heap. + +5. If all OK, 'cd ..' and 'make install'. + +6. For documentation, 'cd src' and then 'make doc'. The documentation + will be in ./doc/html -- use index.html to start. Copy these whereever + you want. + +7. Alternatively look at ./src/test/w32dtest.cpp for example code on using + w32dlib. ---------------------------------------------------------------------- -$Id: INSTALL,v 1.1 2005-03-22 01:43:54 ianc Exp $ +$Id: INSTALL,v 1.2 2005-04-05 01:01:58 ianc Exp $ diff --git a/src/GNUmakefile b/src/GNUmakefile index 5cc058f..f654739 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: GNUmakefile,v 1.6 2005-04-04 00:52:23 ianc Exp $ +# $Id: GNUmakefile,v 1.7 2005-04-05 01:01:58 ianc Exp $ # @@ -26,9 +26,9 @@ # # The directory to install the built library, headers and docs into. -# *** NB: USE FORWARD SLASHES *** +# NB: Use *forward* slashes if setting to a DOS path. # -INSTALLDIR = C:/w32dlib +INSTALLDIR = /usr/local # Set this to one to generate a wd32lib-config and copy it to /usr/local/bin # when installing. @@ -46,7 +46,7 @@ DEBUG = -g -DW32D_DEBUG # Do not change past here. # Well, unless something doesn't work of course... # -TARGET = w32dlib.a +TARGET = libw32dlib.a SOURCES = autocheck.cpp \ button.cpp \ @@ -92,6 +92,9 @@ $(DOCDIR)/html/index.html: $(HEADERS) clean: -rm -f $(TARGET) $(OBJECTS) depend.mak +install: $(TARGET) + ./install.sh $(INSTALLDIR) $(CREATECONF) + depend: @echo Dependencies updated.... $(CXX) -MM $(FLAGS) $(SOURCES) > $(DEPEND) diff --git a/src/install.sh b/src/install.sh new file mode 100644 index 0000000..e3274ae --- /dev/null +++ b/src/install.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Install script to w32dlib +# +# $Id$ +# + +if [ "$2" == "" ] ; then + echo usage: $0 install-dir script-flag + exit 1 +fi + +incbase=$1/include +incdir=$incbase/w32dlib +libdir=$1/lib +mkinfo=$2 +conf=/usr/local/bin/w32dlib-config + +echo ==== Copying header files to $incdir ==== +mkdir -p $incdir +cp --verbose --force w32dlib/*.h $incdir + +echo ==== Copying library files to $libdir ==== +mkdir -p $libdir +cp --verbose --force libw32dlib.a $libdir + +if [ $mkinfo == "1" ] ; then + echo ==== Creating $conf ==== + + cat << EOF > $conf +#!/bin/sh + +if [ "\$1" == "--libs" ] ; then + echo -L$libdir -mwindows -lw32dlib +elif [ "\$1" == "--cflags" ] ; then + echo -I$incbase +else + echo usage: \$0 [--libs\|--cflags] +fi + +EOF + +fi + +exit 0 diff --git a/src/test/GNUmakefile b/src/test/GNUmakefile index 97ca9c0..fe28cb0 100644 --- a/src/test/GNUmakefile +++ b/src/test/GNUmakefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: GNUmakefile,v 1.1 2005-03-24 00:07:40 ianc Exp $ +# $Id: GNUmakefile,v 1.2 2005-04-05 01:01:58 ianc Exp $ # @@ -26,7 +26,7 @@ TARGET = w32dtst.exe SOURCES = w32dtst.cpp -LIB = ../w32dlib.a +LIB = -L.. -lw32dlib RES = dialog @@ -36,7 +36,7 @@ FLAGS = -I.. -Wall -L.. -g DEPEND = depend.mak -$(TARGET): $(OBJECTS) $(LIB) +$(TARGET): $(OBJECTS) ../libw32dlib.a $(CXX) -o $(TARGET) $(FLAGS) $(OBJECTS) -mwindows -mconsole $(LIB) $(RES).o: $(RES).rc $(RES).h -- cgit v1.2.3