HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • Back to Ticket #371

Ticket #371: TinyGL-0.4.patch

File TinyGL-0.4.patch, 6.1 KB (added by michaelvoliveira, 5 years ago)

Patch to build in Haiku. tested with GCC2 and GCC4

  • config.mk

    diff -Naur TinyGL/config.mk TinyGL-haiku/config.mk
    old new  
    1818# Select window API for TinyGL:  
    1919 
    2020# standard X11 GLX like API  
    21 TINYGL_USE_GLX=y 
     21#TINYGL_USE_GLX=y 
    2222 
    2323# BEOS API 
    24 #TINYGL_USE_BEOS=y 
     24TINYGL_USE_BEOS=y 
    2525 
    2626# Micro Windows NanoX API 
    2727#TINYGL_USE_NANOX=y 
    … …  
    4040UI_OBJS=x11.o 
    4141endif 
    4242 
     43ifdef TINYGL_USE_BEOS 
     44UI_LIBS= -L/boot/common/lib -lnetwork 
     45UI_INCLUDES=  
     46endif 
     47 
    4348##################################################################### 
    4449# Micro windowX11 configuration (for the examples only) 
    4550 
    … …  
    7580# Compile and link control 
    7681 
    7782# UNIX systems 
    78 DIRS= src examples 
     83#DIRS= src examples 
    7984 
    8085# BeOS 
    81 # DIRS= src BeOS 
     86DIRS= src BeOS 
    8287 
  • examples/Makefile

    diff -Naur TinyGL/examples/Makefile TinyGL-haiku/examples/Makefile
    old new  
    88        rm -f core *.o *~ $(PROGS) 
    99 
    1010mech: mech.o glu.o $(UI_OBJS) $(GL_DEPS) 
    11         $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm 
     11        $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) 
    1212 
    1313texobj: texobj.o $(UI_OBJS) $(GL_DEPS) 
    14         $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm 
     14        $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) 
    1515 
    1616gears: gears.o $(UI_OBJS) $(GL_DEPS) 
    17         $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm 
     17        $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) 
    1818 
    1919spin: spin.o $(UI_OBJS) $(GL_DEPS) 
    20         $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm 
     20        $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) 
    2121 
    2222.c.o: 
    2323        $(CC)   $(CFLAGS) $(GL_INCLUDES) $(UI_INCLUDES) -c $*.c 
  • src/Makefile

    diff -Naur TinyGL/src/Makefile TinyGL-haiku/src/Makefile
    old new  
    11include ../config.mk 
    22 
    3 OBJS= api.o list.o vertex.o init.o matrix.o texture.o \ 
     3OBJS= api.o shm.o list.o vertex.o init.o matrix.o texture.o \ 
    44      misc.o clear.o light.o clip.o select.o get.o error.o \ 
    55      zbuffer.o zline.o zdither.o ztriangle.o \ 
    66      zmath.o image_util.o oscontext.o msghandling.o \ 
  • src/shm.c

    diff -Naur TinyGL/src/shm.c TinyGL-haiku/src/shm.c
    old new  
     1/*------------------------------------------------------------------------- 
     2 * 
     3 * shm.c 
     4 *        BeOS System V Shared Memory Emulation 
     5 * 
     6 * Copyright (c) 1999-2001, Cyril VELTER 
     7 * 
     8 *------------------------------------------------------------------------- 
     9 */ 
     10 
     11#include <sys/shm.h> 
     12#include <OS.h> 
     13#include <errno.h> 
     14 
     15/* Emulating SYS shared memory with beos areas. WARNING : fork clone 
     16areas in copy on write mode */ 
     17 
     18 
     19/* Detach from a shared mem area based on its address */ 
     20int 
     21shmdt(char *shmaddr) 
     22{ 
     23        /* Find area id for this address */ 
     24        area_id         s; 
     25 
     26        s = area_for(shmaddr); 
     27 
     28        /* Delete area */ 
     29        return delete_area(s); 
     30} 
     31 
     32/* Attach to an existing area */ 
     33int * 
     34shmat(int memId, int m1, int m2) 
     35{ 
     36        /* Get our team id */ 
     37        thread_info thinfo; 
     38        team_info       teinfo; 
     39        area_info       ainfo; 
     40 
     41        get_thread_info(find_thread(NULL), &thinfo); 
     42        get_team_info(thinfo.team, &teinfo); 
     43 
     44        /* Get area teamid */ 
     45        if (get_area_info(memId, &ainfo) != B_OK) 
     46                printf("AREA %d Invalide\n", memId); 
     47 
     48        if (ainfo.team == teinfo.team) 
     49        { 
     50                /* 
     51                 * the area is already in our address space, just return the address 
     52                 */ 
     53                return (int *) ainfo.address; 
     54        } 
     55        else 
     56        { 
     57                /* 
     58                 * the area is not in our address space, clone it before and return 
     59                 * the address 
     60                 */ 
     61                area_id         narea; 
     62 
     63                narea = clone_area(ainfo.name, &(ainfo.address), B_CLONE_ADDRESS, B_READ_AREA | B_WRITE_AREA, memId); 
     64                get_area_info(narea, &ainfo); 
     65                return (int *) ainfo.address; 
     66        } 
     67} 
     68 
     69/* Control a shared mem area */ 
     70int 
     71shmctl(int shmid, int flag, struct shmid_ds * dummy) 
     72{ 
     73        if (flag == IPC_RMID) 
     74        { 
     75                /* Delete the area */ 
     76                delete_area(shmid); 
     77                return 0; 
     78        } 
     79        if (flag == IPC_STAT) 
     80        { 
     81                /* Find any SYSV area with the shmid in its name */ 
     82 
     83                area_info       inf; 
     84                team_info       infteam; 
     85                int32           cookteam = 0; 
     86                char            name[50]; 
     87 
     88                sprintf(name, "SYSV_IPC %d", shmid); 
     89 
     90                dummy->shm_nattch = 0; 
     91 
     92                while (get_next_team_info(&cookteam, &infteam) == B_OK) 
     93                { 
     94                        int32           cook = 0; 
     95 
     96                        while (get_next_area_info(infteam.team, &cook, &inf) == B_OK) 
     97                        { 
     98                                if (strcmp(name, inf.name) == 0) 
     99                                        dummy->shm_nattch++; 
     100                        } 
     101                } 
     102 
     103                errno = 0; 
     104                return 0; 
     105        } 
     106        errno = EINVAL; 
     107        return -1; 
     108} 
     109 
     110/* Get an area based on the IPC key */ 
     111int 
     112shmget(int memKey, int size, int flag) 
     113{ 
     114        char            nom[50]; 
     115        void       *Address; 
     116        area_id         parea; 
     117 
     118        /* Area name */ 
     119        sprintf(nom, "SYSV_IPC_SHM : %d", memKey); 
     120 
     121        /* Find area */ 
     122        parea = find_area(nom); 
     123 
     124        /* area exist, just return its id */ 
     125        if (parea != B_NAME_NOT_FOUND) 
     126                return parea; 
     127 
     128        /* area does not exist and no creation is requested : error */ 
     129        if (flag == 0) 
     130                return -1; 
     131 
     132        /* 
     133         * area does not exist and its creation is requested, create it (be sure 
     134         * to have a 4ko multiple size 
     135         */ 
     136        return create_area(nom, &Address, B_ANY_ADDRESS, ((size / 4096) + 1) * 4096, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); 
     137} 
  • src/zbuffer.c

    diff -Naur TinyGL/src/zbuffer.c TinyGL-haiku/src/zbuffer.c
    old new  
    265265            p += 3; 
    266266        } while (--n > 0); 
    267267 
    268         (char *) p1 += linesize; 
     268        (char *) p1; 
     269        p1 += linesize; 
    269270    } 
    270271} 
    271272 
  • src/zgl.h

    diff -Naur TinyGL/src/zgl.h TinyGL-haiku/src/zgl.h
    old new  
    329329GLSpecBuf *specbuf_get_buffer(GLContext *c, const int shininess_i,  
    330330                              const float shininess); 
    331331 
    332 #ifdef __BEOS__ 
     332#if defined(__BEOS__) || defined(__HAIKU__) 
    333333void dprintf(const char *, ...); 
    334334 
    335 #else /* !BEOS */ 
     335#else /* !BEOS !HAIKU */ 
    336336 
    337337#ifdef DEBUG 
    338338 
    … …  
    344344#define dprintf(format, args...) 
    345345 
    346346#endif 
    347 #endif /* !BEOS */ 
     347#endif /* !BEOS !HAIKU */ 
    348348 
    349349/* glopXXX functions */ 
    350350 

Download in other formats:

  • Original Format

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/