Menu

cygwin?

Jason Day
2001-03-19
2001-03-25
  • Jason Day

    Jason Day - 2001-03-19

    Has anybody tried to get fte to compile under cygwin?

     
    • jon svendsen

      jon svendsen - 2001-03-20

      no, but i have successfully compiled with mingw, if that is of any help :)
      (i don't know if you can use the win32api headers with cygwin gcc, but if you can,
      it should be pretty much the same)

       
      • Jason Day

        Jason Day - 2001-03-20

        I'll give it a try.  Did you do anything special to compile with mingw?

         
        • jon svendsen

          jon svendsen - 2001-03-20

          I made this little makefile (not very tested, but it worked fine for me)
          Ugly hack ahead, I found that defining BCPP as the compiler included all the right
          headers.

          It also depends on changing lines 49 and 50 in CON_NT.CPP from
          --
          static Initialized = 0;
          static MousePresent = 0;
          --
          to
          --
          static int Initialized = 0;
          static int MousePresent = 0;
          --
          (I have found this to be necessary in order to compile with any gcc 2.95.2 port.)

          And here is the makefile

          --fte-mngw.mak--
          # depends on changes to con_nt.cpp
          #
          # -DBCPP works to include correct headers

          INCDIR    =
          LIBDIR    =

          OPTIMIZE  = -O -s

          MT        = -Zmt

          CC        = gcc
          LD        = gcc

          OEXT=o

          DEFS=-DNT -DNTCONSOLE -DBCPP

          CCFLAGS   = $(OPTIMIZE) -x c++ -Wall $(DEFS) $(INCDIR) -pipe
          LDFLAGS   = $(OPTIMIZE) $(LIBDIR)

          .SUFFIXES: .cpp .$(OEXT)

          include objs.inc

          .cpp.$(OEXT):
              $(CC) $(CCFLAGS) -c $<

          .c.$(OEXT):
              $(CC) $(CCFLAGS) -c $<

          all: cfte.exe fte.exe

          # don't know how to use .def files on gcc, commented out

          cfte.exe: $(CFTE_OBJS) # cfte.def
              $(LD) $(LDFLAGS) $(CFTE_OBJS) -o cfte.exe $(LIBS)

          defcfg.cnf: defcfg.fte cfte.exe
              cfte defcfg.fte defcfg.cnf

          defcfg.h: defcfg.cnf bin2c.exe
              bin2c defcfg.cnf >defcfg.h

          bin2c.exe: bin2c.cpp
              $(CC) $(CCFLAGS) bin2c.cpp -o bin2c.exe

          c_config.$(OEXT): defcfg.h

          fte.exe: $(OBJS) $(NTOBJS) # fte.def
              $(LD) $(LDFLAGS) $(OBJS) $(NTOBJS) -o fte.exe $(LIBS)

          ------

           
          • Darin

            Darin - 2001-03-21

            Those changes to the source code are quite important.  They actually should be made to con_os2.cpp as well.

            Those are now checked in so you don't need to continue making those changes.

            As for the makefile, send it to me as a file attach or something so I can check it in for others to use.

             
            • jon svendsen

              jon svendsen - 2001-03-21

              con_dosx.cpp also needs to be fixed.

              i'll bundle up some stuff and mail it to you. i've also created a win32 makefile for
              more recent borland compilers, and i've fixed a bug in the dos code that
              interestingly enough prevented keyboard input in some cases :)

              i'll write a more descriptive README

               
          • Jason Day

            Jason Day - 2001-03-21

            Thanks!  Using the mingw that comes with cygwin, I'm able to get fte to compile and run, but it can't open any files (a somewhat important ability for a text editor to have :).  I don't know yet if it's a problem with cygwin, mingw, or something I'm doing.  I'll investigate it some more when I get time.

            On another topic, what is the best way to submit patches?

            Thanks,
            Jason

             
            • jon svendsen

              jon svendsen - 2001-03-21

              Ah, I suspect you may be having a problem with the path separator.
              When target is defined as NT, PATHTYPE will be defined as PT_DOSISH, while
              the cygwin environment possibly needs PT_UNIXISH. try commenting out lines
              155 thru 159 in sysdep.h, and inserting #define PATHTYPE PT_UNIXISH instead.

              don't know if this will solve your problem, but it should be worth a try.

               
              • Jason Day

                Jason Day - 2001-03-22

                It looks like the stat that comes with cygwin's mingw is broken -- whenever I stat a directory, the st_mode field is always 0.  This is what keeps fte (and cfte) from loading files.  Here's a small test program:

                --- test.c ---
                #include <stdio.h>
                #include <stdlib.h>
                #include <sys/stat.h>

                int main (int argc, char *argv[]) {
                    char path[256];
                    struct stat statbuf;

                    stat ("C:\\cygwin\\usr", &statbuf);
                    printf ("mode = %d\n", statbuf.st_mode);
                    stat ("C:\\cygwin\\usr\\", &statbuf);
                    printf ("mode = %d\n", statbuf.st_mode);
                    stat ("/usr", &statbuf);
                    printf ("mode = %d\n", statbuf.st_mode);

                    _fullpath (path, "test.c", 255);
                    stat (path, &statbuf);
                    printf ("mode = %d\n", statbuf.st_mode);
                    return 0;
                }
                ---

                I compiled this with this command:
                gcc -o test test.c -mno-cygwin

                And the output:
                $ ./test.exe
                mode = 0

                Can you try compiling this and tell me what you get?

                Thanks,
                Jason

                 
                • jon svendsen

                  jon svendsen - 2001-03-22

                  Sorry for enormous responetime, I had some trouble connecting to
                  sourceforge.net earlier.

                  Anyway, with those single backslashes, your code won't compile at all.
                  replacing with double backslashes or ordinary unixish slashes, the code
                  compiles on native mingw (gcc -o test test.c) and outputs:

                  --
                  mode = 16895
                  mode = 16895
                  mode = 16895
                  mode = 33206
                  --

                  (this provided that all directories exist, and test.c is in cwd of course)

                   
                  • Jason Day

                    Jason Day - 2001-03-25

                    I've been having problems connecting to sourceforge, too.  And it seems to have stripped out a backslash in the email too -- 2 backslashes: \\

                    Anyway, I finally got it to work.  You have to define __MSVC__ to get stat to work, and you need to install some extra stuff to get C++ to work.  I'll write up everything I did to get it working and submit it to the patches section.  Thanks for all your help!

                    Jason

                     

Log in to post a comment.

Auth0 Logo