Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 10/01/2007, à 09:49

cybolo

problème de compilation à la création d'un usplash

Bonjour à tous
Je suis un nouvel utilisateur de Edgy et j'ai bien envie de m'essayer à la création de usplashes.

J'ai récupéré les fichier d'exemple (eft-theme.c et le makefile associé dans /usr/share/doc/usplash-dev/examples)
Et je les ai modifiés pour avoir juste une image en 1024_768 et utiliser les throbber_fore.png et throbber_back.png comme barre de chargement.
Le problème c'est qu'à la compilation j'obtiens une erreur de dépendance circulaire :

make: Dépendance circulaire gits_1024_768.png <- gits_1024_768.png.c abandonnée.
pngtousplash gits_1024_768.png > gits_1024_768.png.c

gcc  -g -Wall -fPIC -o gits_1024_768.png.c.o -c gits_1024_768.png.c
make: Dépendance circulaire throbber_fore.png <- throbber_fore.png.c abandonnée.

pngtousplash throbber_fore.png > throbber_fore.png.c
gcc  -g -Wall -fPIC -o throbber_fore.png.c.o -c throbber_fore.png.c

make: Dépendance circulaire throbber_back.png <- throbber_back.png.c abandonnée.
pngtousplash throbber_back.png > throbber_back.png.c

gcc  -g -Wall -fPIC -o throbber_back.png.c.o -c throbber_back.png.c
gcc  -g -Wall -fPIC -o gits-theme.c.o -c gits-theme.c
make: Dépendance circulaire helvB10.bdf <- helvB10.bdf.c abandonnée.
bdftousplash helvB10.bdf > helvB10.bdf.c
gcc  -g -Wall -fPIC -o helvB10.bdf.c.o -c helvB10.bdf.c
gcc  -g -Wall -fPIC -shared -o gits-theme.so gits_1024_768.png.c.o throbber_fore.png.c.o throbber_back.png.c.o gits-theme.c.o helvB10.bdf.c.o

Je met les sources du fichier.c et du makefile :

gits-theme.c

#include <usplash-theme.h>
/* Needed for the custom drawing functions */
#include <usplash_backend.h>

extern struct usplash_pixmap pixmap_gits_1024_768;
extern struct usplash_pixmap pixmap_throbber_back;
extern struct usplash_pixmap pixmap_throbber_fore;
extern struct usplash_font font_helvB10;

void t_init(struct usplash_theme* theme);
void t_clear_progressbar(struct usplash_theme* theme);
void t_draw_progressbar(struct usplash_theme* theme, int percentage);
void t_animate_step(struct usplash_theme* theme, int pulsating);

struct usplash_theme usplash_theme_1024_768;

/* Theme definition */
struct usplash_theme usplash_theme_1024_768 = {
    .version = THEME_VERSION,
    .next = NULL,
    .ratio = USPLASH_4_3,

    /* Background and font */
    .pixmap = &pixmap_gits_1024_768,
    .font   = &font_helvB10,

    /* Palette indexes */
    .background             = 0x0,
      .progressbar_background = 0x7,
      .progressbar_foreground = 0x156,
    .text_background        = 0x15,
    .text_foreground        = 0x31,
    .text_success           = 0x171,
    .text_failure           = 0x156,

    /* Progress bar position and size in pixels */
      .progressbar_x      = 45, 
      .progressbar_y      = 85,
      .progressbar_width  = 216,
      .progressbar_height = 8,

    /* Text box position and size in pixels */
      .text_x      = 45,
      .text_y      = 335,
      .text_width  = 440,
      .text_height = 150,

    /* Text details */
      .line_height  = 20,
      .line_length  = 37,
      .status_width = 40,

    /* Functions */
    .init = t_init,
    .clear_progressbar = t_clear_progressbar,
    .draw_progressbar = t_draw_progressbar,
    .animate_step = t_animate_step,
};


void t_init(struct usplash_theme *theme) {
    int x, y;
    usplash_getdimensions(&x, &y);
    theme->progressbar_x = (x - theme->pixmap->width)/2 + theme->progressbar_x;
    theme->progressbar_y = (y - theme->pixmap->height)/2 + theme->progressbar_y;
}

void t_clear_progressbar(struct usplash_theme *theme) {
    t_draw_progressbar(theme, 0);
}

void t_draw_progressbar(struct usplash_theme *theme, int percentage) {
    int w = (pixmap_throbber_back.width * percentage / 100);
    usplash_put(theme->progressbar_x, theme->progressbar_y, &pixmap_throbber_back);
    if(percentage == 0)
        return;
    if(percentage < 0)
        usplash_put_part(theme->progressbar_x - w, theme->progressbar_y, pixmap_throbber_back.width + w,
                         pixmap_throbber_back.height, &pixmap_throbber_fore, -w, 0);
    else
        usplash_put_part(theme->progressbar_x, theme->progressbar_y, w, pixmap_throbber_back.height, 
                         &pixmap_throbber_fore, 0, 0);
}

void t_animate_step(struct usplash_theme* theme, int pulsating) {

    static int pulsate_step = 0;
    static int pulse_width = 28;
    static int step_width = 2;
    static int num_steps = (216 - 28)/2;
    int x1;

    if (pulsating) {
        t_draw_progressbar(theme, 0);
    
        if(pulsate_step < num_steps/2+1)
            x1 = 2 * step_width * pulsate_step;
        else
            x1 = 216 - pulse_width - 2 * step_width * (pulsate_step - num_steps/2+1);

        usplash_put_part(theme->progressbar_x + x1, theme->progressbar_y, pulse_width,
                         pixmap_throbber_fore.height, &pixmap_throbber_fore, x1, 0);

        pulsate_step = (pulsate_step + 1) % num_steps;
    }
}

makefile :

CC=gcc
CFLAGS=-g -Wall -fPIC
LDFLAGS=
INCLUDES=

COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS)

INSTALL = /usr/bin/install -c
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROGRAM = $(INSTALL) -m 755

gits-theme.so: gits_1024_768.png.c.o throbber_fore.png.c.o throbber_back.png.c.o gits-theme.c.o helvB10.bdf.c.o
    $(COMPILE) -shared -o $@ $^
    
gits_1024_768.png.c: gits_1024_768.png
    pngtousplash gits_1024_768.png > gits_1024_768.png.c

throbber_fore.png.c: throbber_fore.png
    pngtousplash throbber_fore.png > throbber_fore.png.c

throbber_back.png.c: throbber_back.png
    pngtousplash throbber_back.png > throbber_back.png.c

helvB10.bdf.c: helvB10.bdf
    bdftousplash helvB10.bdf > helvB10.bdf.c

%.c.o: %.c
    $(COMPILE) -o $@ -c $<

install:
    $(INSTALL) -d $(DESTDIR)/lib/usplash
    $(INSTALL_PROGRAM) gits-theme.so $(DESTDIR)/usr/lib/usplash/gits-theme.so
clean:
    rm -f *.png.c *.bdf.c *.c.o

Et j'ai bien pensé à passer les images png en palettes 255 couleurs.
voilà, si quelqu'un a une idée..Merci d'avance:)

#2 Le 10/01/2007, à 19:59

cybolo

Re : problème de compilation à la création d'un usplash

up..

#3 Le 10/01/2007, à 23:17

Balkoth

Re : problème de compilation à la création d'un usplash

Bonsoir, pourquoi avoir modifié les règles génériques du Makefile ?

%.png.c: %.png
        pngtousplash $< > $@

%.bdf.c: %.bdf
        bdftousplash $< > $@

Ces règles vont s'appliquer à tous les fichiers .png et .bdf du dossier courant, pas la peine de s'embêter à les changer.

Sinon, je viens de tester avec l'exemple sans rien modifier, et make donne les mêmes erreurs de dépendance circulaire.
Cependant, le fichier .so est bien créé. Si c'est aussi le cas pour toi, plus de problème wink

Hors ligne

#4 Le 11/01/2007, à 10:01

cybolo

Re : problème de compilation à la création d'un usplash

Salut
J'avais modifié les règles comme j'avais que trois images et pour être vraiment sûr que j'avais pas fait d'erreur, comme je suis pas encore super calé en expressions génériques.

Je vais voir s'il crée le fichier .so
Merci pour ton aide.

#5 Le 12/01/2007, à 10:22

cybolo

Re : problème de compilation à la création d'un usplash

J'ai essayé la compilation. Il me crée bien le fichier .so mais quand je l'installe et le teste j'ai un écran tout moche style écran test de chaine de télévision.
Je vais chercher la raison, mais est-ce que toi tu avais testé si le fichier .so obtenu marchait?

Merci