Ticket #65628: patch-cgx-build.diff

File patch-cgx-build.diff, 10.2 KB (added by mbrethen, 2 years ago)
  • src/Makefile

    diff -ur cgx_2.18.orig/src/Makefile cgx_2.18/src/Makefile
    old new  
    1 CFLAGS = -O2 -Wall -Wno-narrowing \
     1CFLAGS += -O2 -Wall -Wno-narrowing \
    22  -I./ \
    3   -I/usr/include \
    4   -I/usr/include/GL \
     3  -I@PREFIX@/include \
     4  -I@PREFIX@/include/GL \
    55  -I../../libSNL/src \
    6   -I../../glut-3.5/src \
    7   -I/usr/X11/include
     6  -I../../glut-3.5/src
    87
    9 LFLAGS = \
    10   -L/usr/lib64 -lGL -lGLU \
    11   -L/usr/X11R6/lib64 -lX11 -lXi -lXmu -lXext -lXt -lSM -lICE \
    12   -lm -lpthread -lrt
     8LFLAGS += \
     9  -lGL -lGLU -lglut \
     10  -lX11 -lXi -lXmu -lXext -lXt -lSM -lICE \
     11  -lm -lpthread
     12
     13CXXFLAGS +=
    1314
    1415
    1516# on 32bit systems change lib64 to lib
     
    2223 userFunction.c
    2324
    2425SUTIL = \
    25  ../../glut-3.5/src/layerutil.c \
    26  ../../glut-3.5/src/glut_dials.c \
    27  ../../glut-3.5/src/glut_ext.c \
    28  ../../glut-3.5/src/glut_mesa.c \
    29  ../../glut-3.5/src/glut_menu.c \
    30  ../../glut-3.5/src/glut_modifier.c \
    31  ../../glut-3.5/src/glut_space.c \
    32  ../../glut-3.5/src/glut_shapes.c \
    33  ../../glut-3.5/src/glut_tablet.c \
    34  ../../glut-3.5/src/glut_warp.c \
    35  ../../glut-3.5/src/glut_8x13.c \
    36  ../../glut-3.5/src/glut_9x15.c \
    37  ../../glut-3.5/src/glut_hel10.c \
    38  ../../glut-3.5/src/glut_hel18.c \
    39  ../../glut-3.5/src/glut_hel12.c \
    40  ../../glut-3.5/src/glut_tr10.c \
    41  ../../glut-3.5/src/glut_tr24.c \
    42  ../../glut-3.5/src/glut_bitmap.c \
    43  ../../glut-3.5/src/glut_cursor.c \
    44  ../../glut-3.5/src/glut_event.c \
    45  ../../glut-3.5/src/glut_get.c \
    46  ../../glut-3.5/src/glut_overlay.c \
    47  ../../glut-3.5/src/glut_input.c \
    48  ../../glut-3.5/src/glut_stroke.c \
    49  ../../glut-3.5/src/glut_teapot.c \
    50  ../../glut-3.5/src/glut_winmisc.c \
    51  ../../glut-3.5/src/glut_fullscrn.c \
    52  ../../glut-3.5/src/glut_cindex.c \
    53  ../../glut-3.5/src/glut_roman.c \
    54  ../../glut-3.5/src/glut_mroman.c \
    55  ../../glut-3.5/src/glut_swidth.c \
    56  ../../glut-3.5/src/glut_bwidth.c \
    57  ../../glut-3.5/src/glut_win.c \
    58  ../../glut-3.5/src/glut_init.c \
    59  ../../glut-3.5/src/glut_util.c \
    6026 uselibSNL.cpp \
    6127 generateTet.cpp \
    6228 ../../libSNL/src/*.cpp
     
    6632OUTIL = $(SUTIL:.c=.o)
    6733
    6834cgx: $(OLIB) $(OUTIL) $(OULIB)
    69         g++  $(OULIB)  $(OLIB) $(OUTIL)  $(CFLAGS) $(LFLAGS) -o  $@
     35        $(CXX)  $(OULIB)  $(OLIB) $(OUTIL)  $(CFLAGS) $(LFLAGS) $(CXXFLAGS) -o  $@
    7036
    7137
    7238
  • src/cgx.h

    diff -ur cgx_2.18.orig/src/cgx.h cgx_2.18/src/cgx.h
    old new  
    2525#include "extUtil.h"
    2626#include "trackball.h"
    2727
     28/* change from sem_init to sem_open */
     29#define sem_n *nptr
     30#define sem_g *gptr
     31#define sem_rep *rptr
     32#define sem_stn *sptr
     33#define sem_map3d *mptr
     34#define sem_cute *cptr
    2835
    2936/* factors for the geometric tolerance for merging */
    3037/* the space used by all lines will be multiplied with this value to calculate the default */
     
    8888  /* default tet mesher, 0:Netgen ng_vol, 1:tetgen */
    8989  #define     TETMESHER  1
    9090#else
    91   #define     HELPFILE        {"/usr/local/CalculiX/cgx_2.18/doc/cgx/cgx.html",\
    92     "/usr/local/CalculiX/ccx_2.18/doc/ccx/ccx.html"}
     91  #define     HELPFILE        {"@PREFIX@/share/doc/CalculiX/cgx/cgx.html",\
     92    "@PREFIX@/share/doc/CalculiX/ccx/ccx.html"}
    9393  /* default tet mesher, 0:Netgen ng_vol, 1:tetgen */
    9494  #define     TETMESHER  1
    9595#endif
     
    105105#else
    106106/* #define     BROWSER         {"netscape"} */
    107107/*   #define     BROWSER         {"mozilla"} */
    108   #define     BROWSER         {"firefox"}
     108  #define     BROWSER         {"openbrowser"}
    109109/* #define     PSVIEWER         {"ghostview"} */
    110   #define     PSVIEWER         {"gv"}
     110  #define     PSVIEWER         {"open"}
    111111  #define     ALLOW_SYS_FLAG   0
    112112#endif
    113113
  • src/cgx.c

    diff -ur cgx_2.18.orig/src/cgx.c cgx_2.18/src/cgx.c
    old new  
    854854    while( access( "0__.tga", F_OK ) != 0 );
    855855    while( access( "1__.tga", F_OK ) != 0 );
    856856    while( access( "2__.tga", F_OK ) != 0 );
    857     //sprintf( buffer, "composite -compose atop -gravity SouthWest -geometry +1+1 2__.tga 1__.tga 3__.tga");
     857    sprintf(buffer, "mogrify -auto-orient 0__.tga");
     858    system(buffer);
     859    sprintf(buffer, "mogrify -auto-orient 1__.tga");
     860    system(buffer);
     861    sprintf(buffer, "mogrify -auto-orient 2__.tga");
     862    system(buffer);
     863
    858864    sprintf( buffer, "composite -gravity SouthWest -geometry +1+1 2__.tga 1__.tga 3__.tga");
    859865    system (buffer);
    860866    while( access( "3__.tga", F_OK ) != 0 );
     867    sprintf(buffer, "mogrify -auto-orient 3__.tga");
     868    system(buffer);
    861869    //sprintf( buffer, "composite -compose atop -gravity NorthWest -geometry +%d+%d 3__.tga 0__.tga hcpy_%d.tga",
    862870    sprintf( buffer, "composite -alpha off -gravity NorthWest -geometry +%d+%d 3__.tga 0__.tga hcpy_%d.tga",
    863871                (GLint)width_menu*19/20, (GLint)height_menu/10, nr);
    864872    system (buffer);
     873    sprintf(buffer, "mogrify -auto-orient hcpy_%d.tga", nr);
     874    system(buffer);
    865875    //printf("%s",buffer);
    866876    sprintf( buffer, "rm -f *__.tga %s",DEV_NULL);
    867877    system (buffer);
     
    906916      getTGAScreenShot(psNr);
    907917      /* on some systems PS has to be changed to PS2 */
    908918      //sprintf( buffer, "convert -density %dx%d -page +49+196 -gamma %lf hcpy_%d.tga PS:hcpy_%d.ps   ", (int)((double)(PS_DENSITY*width_w0)/(double)(INI_SCREEN+INI_MENU_WIDTH)),(int)((double)(PS_DENSITY*width_w0)/(double)(INI_SCREEN+INI_MENU_WIDTH)) , GAMMA, psNr, psNr);
    909       sprintf( buffer, "convert hcpy_%d.tga -page A4 %s", psNr, fileName);
     919      sprintf( buffer, "convert hcpy_%d.tga -auto-orient -page A4 %s", psNr, fileName);
    910920      system (buffer);
    911921      printf("%s\n", buffer);
    912922      sprintf( buffer, "rm -f hcpy_%d.tga %s",psNr,DEV_NULL);
     
    939949      getTGAScreenShot(0);
    940950      while( access( "hcpy_0.tga", F_OK ) != 0 );
    941951      gifNr++;
    942       sprintf( buffer, "convert hcpy_0.tga _%d.gif",gifNr);
     952      sprintf( buffer, "convert hcpy_0.tga -auto-orient _%d.gif",gifNr);
    943953      printf("%s\n",buffer);
    944954      system (buffer);
    945955      if((movieFrames)&&(gifNr>=movieFrames))
     
    963973      if(filePtr!=NULL) sprintf(fileName,"%s.gif",filePtr); else sprintf(fileName,"hcpy_%d.gif",gifNr);
    964974      printf("create %s\n ",fileName);
    965975      getTGAScreenShot(gifNr);
    966       sprintf( buffer, "convert hcpy_%d.tga %s", gifNr, fileName);
     976      sprintf( buffer, "convert hcpy_%d.tga -auto-orient %s", gifNr, fileName);
    967977      system (buffer);
    968978      sprintf( buffer, "rm -f hcpy_%d.tga %s",gifNr,DEV_NULL);
    969979      system (buffer);
     
    978988      if(filePtr!=NULL) sprintf(fileName,"%s.png",filePtr); else sprintf(fileName,"hcpy_%d.png",pngNr);
    979989      printf("create %s\n ",fileName);
    980990      getTGAScreenShot(pngNr);
    981       sprintf( buffer, "convert hcpy_%d.tga %s", pngNr, fileName);
     991      sprintf( buffer, "convert hcpy_%d.tga -auto-orient %s", pngNr, fileName);
    982992      system (buffer);
    983993      sprintf( buffer, "rm -f hcpy_%d.tga %s",pngNr,DEV_NULL);
    984994      system (buffer);
     
    64736475
    64746476  setall=seto( "all" );
    64756477
    6476   if(sem_init(&sem_n, 0, 1) < 0) printf("Error in:sem_init\n");
    6477   if(sem_init(&sem_g, 0, 1) < 0) printf("Error in:sem_init\n");
    6478   if(sem_init(&sem_rep, 0, 1) < 0) printf("Error in:sem_init\n");
    6479   if(sem_init(&sem_stn, 0, 1) < 0) printf("Error in:sem_init\n");
     6478  nptr = sem_open("/sem_n", O_CREAT, 0644, 1);
     6479  sem_unlink("/sem_n");
     6480  if((nptr == SEM_FAILED)) printf("Error in:sem_open\n");
     6481  gptr = sem_open("/sem_g", O_CREAT, 0644, 1);
     6482  sem_unlink("/sem_g");
     6483  if((gptr == SEM_FAILED)) printf("Error in:sem_open\n");
     6484  rptr = sem_open("/sem_rep", O_CREAT, 0644, 1);
     6485  sem_unlink("/sem_rep");
     6486  if((rptr == SEM_FAILED)) printf("Error in:sem_open\n");
     6487  sptr = sem_open("/sem_stn", O_CREAT, 0644, 1);
     6488  sem_unlink("/sem_stn");
     6489  if((sptr == SEM_FAILED)) printf("Error in:sem_open\n");
    64806490
    64816491  if( (parameter= (char **)malloc( MAX_STACK_PARAMS*sizeof(char *))) == NULL )
    64826492    printf("\n\n ERROR: malloc failed\n\n") ;
  • src/parser.c

    diff -ur cgx_2.18.orig/src/parser.c cgx_2.18/src/parser.c
    old new  
    1 #include <extUtil.h>
     1#include <cgx.h>
    22
    33
  • src/pickFunktions.c

    diff -ur cgx_2.18.orig/src/pickFunktions.c cgx_2.18/src/pickFunktions.c
    old new void moveLineEndPoint(int lineNr, int pntNr, double ll 
    45944594    else
    45954595    {
    45964596      printf("ERROR: selected point:%s is no line endpoint\n", point[pntNr].name);
    4597       return(-1);
     4597      return;
    45984598    }
    45994599    u=flag*llength;
    46004600    u/=scale->w;
     
    75357537    /* daten der geschnittenen elemente */
    75367538    if ((cutParam=(CutParam *)malloc((anz->emax+1)*sizeof(CutParam)) ) == NULL ) { printf(" ERROR: malloc failure\n\n"); return;}
    75377539
    7538     if(sem_init(&sem_cute, 0, 1) < 0) printf("Error in:sem_init\n");
     7540    cptr = sem_open("/sem_cute", O_CREAT, 0644, 1);
     7541    sem_unlink("/sem_cute");
     7542    if((cptr = SEM_FAILED)) printf("Error in:sem_open\n");
    75397543    if(threads>anz->e) { nlocalThreads=anz->e; }
    75407544    else nlocalThreads=threads;
    75417545    //nlocalThreads=1;
     
    75637566    glob_cutElement=0;
    75647567    free(tid); tid=NULL;
    75657568    free(targ); targ=NULL;
    7566     if(sem_destroy(&sem_cute) < 0) printf("Error in:sem_init\n");
     7569    if(sem_close(cptr) < 0) printf("Error in:sem_open\n");
    75677570
    75687571    for(e=1; e<anz_e; e++)
    75697572    {
  • src/setFunktions.c

    diff -ur cgx_2.18.orig/src/setFunktions.c cgx_2.18/src/setFunktions.c
    old new  
    1208712088
    1208812089#else
    1208912090
    12090   if(sem_init(&sem_map3d, 0, 1) < 0) printf("Error in:sem_init\n");
     12091  mptr = sem_open("/sem_map3d", O_CREAT, 0644, 1);
     12092  sem_unlink("/sem_map3d");
     12093  if((mptr = SEM_FAILED)) printf("Error in:sem_open\n");
    1209112094  if(threads>set[set1].anz_n) { nlocalThreads=set[set1].anz_n; }
    1209212095  else nlocalThreads=threads;
    1209312096  //nlocalThreads=1;
     
    1213712139  glob_map3d=0;
    1213812140  free(tid); tid=NULL;
    1213912141  free(targ); targ=NULL;
    12140   if(sem_destroy(&sem_map3d) < 0) printf("Error in:sem_init\n");
     12142  if(sem_close(mptr) < 0) printf("Error in:sem_open\n");
    1214112143#endif
    1214212144
    1214312145  if(rsort) free(rsort);