Re: Compiling gtk apps on MingW

2005-07-04 Thread Ricardo Malafaia
holly crap, man!  it worked!! just because of this tiny little detail!

well, just in case anyone is wondering, i also got sed to put all
paths from d:/ from into /d.  just in case, you know...

anyway, here's the complete Makefile, in all its redundant glory, 
that made it work, in case anyone is suffering from the same problem:

# Makefile
PREFIX=/mingw

GTKPATH=/d/GtkWin
GTKBIN=$(GTKPATH)/bin
GTKLIB=$(GTKPATH)/lib
GTKINC=$(GTKPATH)/include

PATH=$(GTKBIN):/usr/bin:/bin:/mingw/bin
CPPFLAGS=-O2 -g
PKG_CONFIG_PATH=$(GTKLIB)/pkgconfig
LD_LIBRARY_PATH=$(GTKLIB):$(GTKBIN):/lib:/usr/lib:/mingw/lib

CC=LD_LIBRARY_PATH=$(LD_LIBRARY_PATH); PATH=$(PATH); export
LD_LIBRARY_PATH PATH; gcc -mwindows -mms-bitfields
PKG=PKG_CONFIG_PATH=$(PKG_CONFIG_PATH); PATH=$(PATH); export
LD_LIBRARY_PATH PATH; pkg-config

GTK_CFLAGS=`$(PKG) --cflags gtk+-2.0 | sed -e 's/d:/\/d/g'`
GTK_LIBS=`$(PKG) --libs gtk+-2.0 | sed -e 's/d:/\/d/g'`
GTK=$(GTK_CFLAGS) $(GTK_LIBS)


all: exec/teste.exe

exec/teste.exe: teste.c
$(CC) teste.c -o exec/teste.exe $(GTK)



On 7/4/05, zhanglei [EMAIL PROTECTED] wrote:
 Ricardo Malafaia writed:
 all: test
 
 test.exe: test.c
gcc.exe $(GTK_CFLAGS) $(GTK_LIBS) test.c -o test.exe
 
 try to put $(GTK_LIBS) to the end of the command line
 
 gcc.exe $(GTK_CFLAGS) -o test.exe  teste.c $(GTK_LIBS)
 

thanks a lot everyone!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Compiling gtk apps on MingW

2005-07-03 Thread Gus Koppel
Ricardo Malafaia wrote:

 well, my Makefile is like this now
 
 PREFIX=/mingw
 PATH=/d/GtkWin/bin:/usr/bin:/bin:/mingw/bin
 CPPFLAGS=-O2 -I/d/GtkWin/include
 PKG_CONFIG_PATH=/d/GtkWin/lib/pkgconfig
 LD_LIBRARY_PATH=/d/GtkWin/bin:/d/GtkWin/lib:/lib:/usr/lib:/mingw/lib
 
 GTK_CFLAGS=`pkg-config --cflags gtk+-2.0 | sed -e 's/d:/\/d/'`
 GTK_LIBS=`pkg-config --libs gtk+-2.0 | sed -e 's/d:/\/d/'`
 
 LDFLAGS=-L/d/GtkWin/bin -L/d/GtkWin/lib 
 
 all: exec/teste.exe
 
 exec/teste.exe: teste.c
   gcc.exe -mwindows -mms-bitfields $(GTK_CFLAGS) $(GTK_LIBS)
   teste.c -o exec/teste.exe
 
 And still doesn't work.  The gcc command line shown, shows not the
 result of the sed processed pkg-config output, but simply `pkg-config
 --cflags gtk+-2.0 | sed -e 's/d:/\/d/'`.

Makefiles are not supposed to contain (or evaluate, rather)
`-expressions. 'make' doesn't treat them the same way the shell does,
i.e. expanding them. 'make' provides the shell function for shell
command expansion instead. Study the 'make' documentation for further
information about this. However, if you use autotools on MinGW (like I
do and like it is recommended), you don't need that either.

If you insist on entering it manually then the GTK+-relevant part of
the linker parameters to include libs should look similar to this:

-Lpath_to_your_gtk_installation/gtk-2.0/lib -lgtk-win32-2.0 \
-lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 \
-lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0

When using autotools, this is what pkg-config adds to the app_LDADD
variable automatically (provided GTK+ is installed properly). In
configure.in the following two lines add that library stuff the portable
way, i.e. without need to change anything between MinGW and Unix.

pkg_modules=gtk+-2.0 = 2.0.0
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])

In makefile.am (in your package src/ directory) there should be the line

app_LDADD = @PACKAGE_LIBS@

where app is the name of the target binary, usually your package name.
You may also add other required libs there, either directly by name or
by other variable names.

This way, when you got that whole automake + autoconf stuff set up, a
simple 'configure' run (which may take quite some time on MinGW, though)
creates (long but often functional) Makefiles. Note that both the bin/
and the lib/ directory of GTK+ should be added to your shell's $PATH
before running 'configure'. Otherwise 'configure' will abort,
complaining it can't find either pkg-config or the GTK+ libs.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Compiling gtk apps on MingW

2005-07-03 Thread David Necas (Yeti)
On Sun, Jul 03, 2005 at 09:37:49AM +0200, Gus Koppel wrote:
 
 Makefiles are not supposed to contain (or evaluate, rather)
 `-expressions.

Why not?  Backquotes work with most shells and thus you
don't depend on GNU make.

Anyway, make never evaluates ``-expressions, see below.
I have a Makefile which bascially consists only of

  PKGCONFIG = pkg-config
  GTK = gtk+-2.0
  LDFLAGS = `$(PKGCONFIG) $(GTK) --libs`
  CFLAGS = `$(PKGCONFIG) $(GTK) --cflags`

in my experimental Gtk+ directory, so I create foo.c, run
make foo and it compiles foo with Gtk+.  I could use
$(shell ...) too, but it would make no difference here.

 'make' doesn't treat them the same way the shell does,
 i.e. expanding them. 'make' provides the shell function for shell
 command expansion instead. Study the 'make' documentation for further
 information about this.

Which reveals make never evaluates `` in the first place.
Backquotes have no special meaning in Makefile, make
substitutes them literally and it's the shell what
subsequently expands them.  So unlike

FOO = $(echo $$RANDOM)
FOO := $(echo $$RANDOM)

where the first gives a different number each time it is
used and the second always the same (echo $$RANDOM is always
run once at the start), both

FOO = `echo $$RANDOM`
FOO := `echo $$RANDOM`

give different numbers each time they are used.  Both
behaviours can be useful:

FOO = $(shell ls)

foo:
cd /tmp; echo $(FOO)

prints the contents of current directory.  But

FOO = `ls`

foo:
cd /tmp; echo $(FOO)

prints the contents of /tmp -- it's the same as

foo:
cd /tmp; echo `ls`

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Compiling gtk apps on MingW

2005-07-01 Thread Ricardo Malafaia
Hello, all!

I'm sure this has been asked before and i searched the archives, but
couldn't find anything to help me.  So, can anyone give me a hand?

I'm having problems with the linking step, as noted in messages which go like:
test.c: undefined reference to `g_print'
test.c: undefined reference to `gtk_main_quit'
.
.

Basically, i have the latest stable MingW, the latest GtkWin
distribuition from Tor's site and the following Makefile:

PREFIX=/mingw
PATH=/d/GtkWin/bin:/usr/bin:/bin:/mingw/bin
CPPFLAGS=-g -O2 -I/d/GtkWin/include
PKG_CONFIG_PATH=/d/GtkWin/lib/pkgconfig
LD_LIBRARY_PATH=/d/GtkWin/bin:/d/GtkWin/lib:/lib:/usr/lib:/mingw/lib

GTK_CFLAGS=-mwindows -mms-bitfields `pkg-config --cflags gtk+-2.0`
GTK_LIBS=`pkg-config --libs gtk+-2.0`

LDFLAGS=-mwindows -mms-bitfields -L/d/GtkWin/bin

all: test

test.exe: test.c
gcc.exe $(GTK_CFLAGS) $(GTK_LIBS) teste.c -o test.exe


and yes, i tried a lot of different configurations for the paths,
including back slashes and more...

does anyone know what may be possibly wrong?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Fwd: Compiling gtk apps on MingW

2005-07-01 Thread Ricardo Malafaia
well, my Makefile is like this now

PREFIX=/mingw
PATH=/d/GtkWin/bin:/usr/bin:/bin:/mingw/bin
CPPFLAGS=-O2 -I/d/GtkWin/include
PKG_CONFIG_PATH=/d/GtkWin/lib/pkgconfig
LD_LIBRARY_PATH=/d/GtkWin/bin:/d/GtkWin/lib:/lib:/usr/lib:/mingw/lib

GTK_CFLAGS=`pkg-config --cflags gtk+-2.0 | sed -e 's/d:/\/d/'`
GTK_LIBS=`pkg-config --libs gtk+-2.0 | sed -e 's/d:/\/d/'`

LDFLAGS=-L/d/GtkWin/bin -L/d/GtkWin/lib 

all: exec/teste.exe

exec/teste.exe: teste.c
gcc.exe -mwindows -mms-bitfields $(GTK_CFLAGS) $(GTK_LIBS) teste.c -o
exec/teste.exe

And still doesn't work.  The gcc command line shown, shows not the
result of the sed processed pkg-config output, but simply `pkg-config
--cflags gtk+-2.0 | sed -e 's/d:/\/d/'`.

i'll try a bit more later...

-- Forwarded message --
From: Ricardo Malafaia [EMAIL PROTECTED]
Date: Jul 1, 2005 4:27 PM
Subject: Re: Compiling gtk apps on MingW
To: Hubert Sokołowski [EMAIL PROTECTED]


ugh!
now that you tell me, it is returning -Ld:/GtkWin/lib as first entry
when i guess it'd better of returning -L/d/GtkWin/lib

hmm, perhaps i should workout a quick sed script? i'll try that in a minute...

On 7/1/05, Hubert Sokołowski [EMAIL PROTECTED] wrote:
 On Fri, 1 Jul 2005 12:06:28 -0300
 does the command
 pkg-config --libs gtk+-2.0
 really returns what it should?



-- 
http://www.spreadfirefox.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list