Skip to contentSkip to conversation

recipe gtk program include directories

DISCUSSION Gerard van den Bosch 2 participants 3 messages Feb 28, 2011 – Mar 1, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I have created a simple program with GTK and now I want to add it as a package in poky. Because it is a single C file I have constructed the following recipe:

DESCRIPTION = "Battery indication"
SECTION = "examples"
LICENSE = "GPL"
DEPENDS = "gtk+"

SRC_URI = "file://image.c"

S = "${WORKDIR}"

do_compile() {
    ${CC} image.c -o image
}
do_install() {
    install -d ${D}${bindir}
    install -m 0755 image ${D}${bindir}
}

Now I have the problem that on my ubuntu computer I normally add pkg-config --libs --cflags gtk+-2.0 to the gcc compile line to include the right directories.

But I don't understand how to do this in a recipe, can someone point me to an example or explain how this is done?

I already looked at a clutter bb file and the gtk-theme bb file but I can't see where they do this. I tried to add CFLAGS += "-Wl,-rpath-link,${STAGING_LIBDIR}" but when I compile it's still missing gtk/gtk.h.

Regards,
Gerard

#1 lore raw
Quoted 22 lines · Gerard van den Bosch

I have created a simple program with GTK and now I want to add it as a package in poky.
Because it is a single C file I have constructed the following recipe:

DESCRIPTION = "Battery indication"
SECTION = "examples"
LICENSE = "GPL"
DEPENDS = "gtk+"

SRC_URI = "file://image.c"

S = "${WORKDIR}"

do_compile() {
     ${CC} image.c -o image
}
do_install() {
     install -d ${D}${bindir}
     install -m 0755 image ${D}${bindir}
}
Quoted 6 lines

Now I have the problem that on my ubuntu computer I normally add pkg-config --libs --cflags gtk+-2.0 to the gcc compile line to include the right directories.

But I don't understand how to do this in a recipe, can someone point me to an example or explain how this is done?

Can't you just add that to the do_compile line as you'd usually do, e.g:

do_compile () {
    ${CC} image.c -o image `pkg-config --libs --cflags gtk+-2.0`
}

? (and add pkgconfig-native to DEPENDS)

Cheers,

Richard

#2 lore raw
Quoted 35 lines · Richard Purdie
Quoted 22 lines · Gerard van den Bosch

I have created a simple program with GTK and now I want to add it as a package in poky.
Because it is a single C file I have constructed the following recipe:

DESCRIPTION = "Battery indication"
SECTION = "examples"
LICENSE = "GPL"
DEPENDS = "gtk+"

SRC_URI = "file://image.c"

S = "${WORKDIR}"

do_compile() {
      ${CC} image.c -o image
}
do_install() {
      install -d ${D}${bindir}
      install -m 0755 image ${D}${bindir}
}
Quoted 6 lines

Now I have the problem that on my ubuntu computer I normally add pkg-config --libs --cflags gtk+-2.0 to the gcc compile line to include the right directories.

But I don't understand how to do this in a recipe, can someone point me to an example or explain how this is done?

Can't you just add that to the do_compile line as you'd usually do, e.g:

do_compile () {
     ${CC} image.c -o image `pkg-config --libs --cflags gtk+-2.0`
}
Quoted 6 lines

? (and add pkgconfig-native to DEPENDS)

Cheers,

Richard

Thanks, adding pkgconfig to the DEPENDS and adding the line I usually add solved the problem. I also had to rename the file from image to something else because the do_install created a folder image and overwrite my compiled image file. But now it compiles and installs :).

Regards,
Gerard