Adding the Cygwin/mingw documentation from Jean-Seb (see e-mail dated Thu 7/9/2009...
authorJohn F. Fay <johnffay@nettally.com>
Sun, 12 Jul 2009 14:07:19 +0000 (14:07 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Sun, 12 Jul 2009 14:07:19 +0000 (14:07 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@829 7f0cb862-5218-0410-a997-914c9d46530a

LISEZMOI.cygwin_mingw [new file with mode: 0644]
README.cygwin_mingw [new file with mode: 0644]

diff --git a/LISEZMOI.cygwin_mingw b/LISEZMOI.cygwin_mingw
new file mode 100644 (file)
index 0000000..6a2f27f
--- /dev/null
@@ -0,0 +1,218 @@
+Glut alors!\r
+\r
+Par Jean-Seb le vendredi 10 juillet 2009, 00:18\r
+\r
+\r
+Freeglut est une évolution open-source de Glut.\r
+Sous Windows, on peut l'utiliser avec Cygwin.\r
+Facile ? Oui, si on accepte de distribuer "cygwin1.dll"\r
+Aidons Freeglut à conquérir son indépendance !\r
+m.à.j 10/7/2009 : génération d'une librairie pour linker depuis la dll.\r
+\r
+\r
+Récupération des sources\r
+\r
+    * Reprenez les sources de la version 2.6.0 qui intègre les changements\r
+      récents.\r
+    * Pour l'instant, il s'agit d'une RC (Release Candidate), mais la version\r
+      finale ne saurait tarder.\r
+    * L'utilisation de la 2.6 est préférable à la branche 2.4-stable, de\r
+      nombreux bugs étant corrigés.\r
+    * Vous trouverez les sources sur le site de Freeglut:\r
+          o http://freeglut.sourceforge.net/\r
+\r
+\r
+Principe\r
+Objectif\r
+\r
+    * Nous allons créer une dll liée à Cygwin, et une bibliothèque statique\r
+      indépendante\r
+    * Nous créerons également une librairie dynamique, permettant de linker avec\r
+      la dll.\r
+\r
+Liste des fichiers générés\r
+\r
+    * freeglut.dll : une dll classique pour le linkage dynamique.\r
+    * libfreeglut.a : la bibliothèque statique. Le programme final est autonome\r
+      (du moins pour OpenGL).\r
+    * libfreeglutdll.a : la bibliothèque dynamique. Le programme final a besoin\r
+      de freeglut.dll.\r
+\r
+\r
+Préparation\r
+\r
+    * Dépliez l'archive freeglut.\r
+    * Allez dans le répertoire src (situé à la racine du répertoire Freeglut),\r
+      et créez un sous-répertoire "Gl"\r
+          o Dans ce sous-répertoire, copiez les fichiers du répertoire\r
+            "include/Gl"\r
+\r
+    * Pourquoi faut-il créer un répertoire "Gl" pour la compilation ?\r
+          o C'était juste pour simplifier les choses lors de mes essais.\r
+          o Sinon vous pouvez créer directement les répertoires, et copier les\r
+            fichiers comme indiqué au point installation (lire plus loin).\r
+\r
+    * Faites un peu de ménage dans /lib :\r
+          o Effacez toutes les références à la glut, pour ne pas avoir de\r
+            conflit au linkage.\r
+          o Cette étape est facultative, vous pouvez également choisir de ne\r
+            faire le ménage qu' après une compilation réussie de Freeglut.\r
+          o Attention à ne pas effacer, dans un enthousiasme rédempteur, la\r
+            bibliothèque glu32.lib (à ne pas confondre avec glut32.lib).\r
+\r
+\r
+Compilation\r
+\r
+    * Oubliez le triptyque ./configure , make , make install.\r
+          o Ca ne marche pas du tout avec Cygwin.\r
+\r
+    * Voici un Makefile qui fera l'affaire:\r
+\r
+#Makefile pour Freeglut 2.6.0-rc et Cygwin\r
+#A placer dans le répertoire "src"\r
+\r
+sources=$(wildcard *.c)\r
+objs=$(sources:.c=.o)\r
+libname=freeglut\r
+\r
+\r
+CFLAGS=-O2 -DTARGET_HOST_MS_WINDOWS -DX_DISPLAY_MISSING -DFREEGLUT_STATIC -I./\r
+LDFLAGS=-lopengl32 -lgdi32 -lwinmm\r
+\r
+nocyg=-mno-cygwin -mwindows\r
+\r
+all: $(objs)\r
+        #construction dll liée à cygwin1.dll\r
+        gcc $(nocyg) $(objs) -shared $(LDFLAGS) -o $(libname).dll\r
+        nm $(libname).dll  | awk 'BEGIN { print "EXPORTS" } /T _glut/ {sub( /^.*T _/, "\t"); print}' > $(libname).def\r
+        dlltool --dllname $(libname).dll --input-def $(libname).def --output-lib lib$(libname)dll.a\r
+\r
+        #construction bibliothèque statique indépendante de cygwin\r
+        ar cr lib$(libname).a $(objs)\r
+        #pas forcément obligatoire (création d'un index pour accélérer les accès)\r
+        ranlib lib$(libname).a\r
+\r
+%.o: %.c\r
+        gcc $(nocyg) -c $(CFLAGS) $<\r
+\r
+clean:\r
+        rm -f *.o $(libname).dll $(libname).def lib$(libname)dll.a lib$(libname).a\r
+\r
+\r
+\r
+\r
+Quelques remarques sur le makefile\r
+\r
+    * Ce makefile crée une dll, une bibliothèque statique (une archive, en\r
+      d'autres termes) et la bibliothèque dynamique qui permettra l'utilisation\r
+      de la dll.\r
+\r
+    * Ne cherchez pas à stripper la bibliothèque statique! Vous ne pourriez plus\r
+      compiler en statique.\r
+          o Par contre, vous pouvez stripper l'exécutable final obtenu lors de\r
+            la compilation de votre application.\r
+\r
+    * J'ai choisi d'appeller la dll et les bibliothèques par leurs "vrais noms":\r
+      freeglut.dll libfreeglutdll.a et libfreeglut.a.\r
+          o Le script configure recréait (pour des raisons de compatibilité avec\r
+            l'ancienne bibliothèque Glut) glut.dll et libglut.a.\r
+          o Lors des mes essais, j'ai eu des conflits avec une authentique\r
+            "glut" qui trainait dans mon "/lib". J'ai décidé d'appeller les\r
+            choses par leur nom, afin d'éviter les confusions.\r
+          o Rien ne vous empêche de renommer la dll, si vous avez besoin\r
+            d'utiliser des programmes Glut que vous ne pouvez pas recompiler.\r
+\r
+    * La bibliothèque dynamique est générée à partir de la dll.\r
+          o Par souci de concision, j'ai utilisé awk. Il génère le fichier\r
+            d'exports utilisé par dlltool.\r
+          o La seule chose notable est la sélection des fonctions dont le nom\r
+            commence par _glut, afin d'éviter d'inclure dans la librairie\r
+            dynamique des fonctions sans rapport avec freeglut.\r
+          o ensuite, on utilise dlltool de façon très classique.\r
+\r
+nm $(libname).dll  | awk 'BEGIN { print "EXPORTS" } /T _glut/ {sub( /^.*T _/, "\t"); print}' > $(libname).def\r
+dlltool --dllname $(libname).dll --input-def $(libname).def --output-lib lib$(libname)dll.a\r
+\r
+\r
+\r
+\r
+Installation\r
+\r
+    * Copiez libfreeglut.a, libfreeglutdll.a dans le répertoire /lib de Cygwin.\r
+    * Copiez freglut.dll dans le system32 de Windows (ce qui est pratique, mais\r
+      pas propre!).\r
+    * Copiez les fichiers headers de Freeglut (/include/gl) dans /usr/include/Gl\r
+      de Cygwin.\r
+    * Copiez les fichiers headers (toujours /include/gl) dans\r
+      /usr/include/mingw/Gl : ceci sert aux compilations avec le flag\r
+      -mno-cygwin, qui utilise alors les includes de mingw.\r
+          o Vous aurez éventuellement besoin d'écraser d'anciens fichiers\r
+            include, correspondants à Glut, si vous l'avez installé avec Cygwin.\r
+\r
+\r
+Utilisation de la librairie\r
+\r
+    * Nous allons tester avec le programme shapes, présent dans\r
+      progs/demos/shapes\r
+          o -mno-cygwin sert à forcer l'utilisation de Mingw sans la grosse\r
+            dépendance cygwin1.dll.\r
+          o -mwindows sert uniquement à enlever l'horrible fenêtre shell (très\r
+            utile pour la mise au point, par contre).\r
+          o -L. (notez le point après le "L") : j'ai laissé libfreeglut.a,\r
+            libfreeglutdll.a et freeglut.dll dans le répertoire de test, le\r
+            temps des tests justement.\r
+\r
+\r
+Compilation en librairie statique freeglut, sans cygwin\r
+\r
+    * Toute l'astuce réside dans le define : -DFREEGLUT_STATIC\r
+          o Il sert à obtenir la bonne décoration des noms de fonctions dans les \r
+            imports de la lib Freeglut.\r
+          o Vous pouvez essayer sans et prendre un éditeur hexa pour voir les\r
+            différences dans l'objet.\r
+    * attention à l'ordre des bibliothèques : -lfreeglut (statique) doit se\r
+      trouver avant la déclaration des bibliothèques dynamiques.\r
+\r
+    * gcc shapes.c -L. -lfreeglut -lopengl32 -lwinmm -lgdi32 -mno-cygwin\r
+      -mwindows -DFREEGLUT_STATIC\r
+\r
+\r
+Compilation avec dll freeglut, sans cygwin\r
+\r
+    * Pour le define, même remarque que ci-dessus\r
+    * L'ordre des bibliothèques n'a plus d'importance.\r
+\r
+    * gcc shapes.c -L. -lopengl32 -lwinmm -lgdi32 -lfreeglut -mno-cygwin\r
+      -DFREEGLUT_STATIC\r
+\r
+\r
+Compilation avec dll freeglut, avec Cygwin\r
+\r
+    * Cet exemple est donné uniquement pour référence, le thème de ce billet étant de se débarrasser de Cygwin.\r
+          o Disons que ça peut servir pendant la mise au point (et encore).\r
+\r
+    * gcc shapes.c -L. -lopengl32 -lwinmm -lgdi32 -lfreeglut\r
+\r
+\r
+\r
+Où sont les dooooocs ?\r
+\r
+    * Freeglut est livré avec sa documentation, plus très à jour.\r
+          o Il semble qu'il y ait un problème avec la doc Glut originale. Non\r
+            seulement elle ne correspond pas forcément au fonctionnement de\r
+            Freeglut, mais de plus, son auteur (Mark Kilgard) l'a copyrighté. Sa\r
+            distribution est donc difficile.\r
+\r
+    * Jocelyn Fréchot a entrepris une mise à niveau des docs pour la version\r
+      2.6.0. On peut les trouver sur son site pour l'instant:\r
+          o http://jocelyn.frechot.free.fr/freeglut/\r
+\r
+\r
+Quelque chose a survécu ...\r
+\r
+    * J'ai également testé la recompilation des démos de la lib Glut originelle\r
+      (paix à ses cendres).\r
+          o Rien de particulier à signaler.\r
+\r
+    * Merci à tous les mainteneurs courageux de Freeglut, qu'on croyait mort,\r
+      mais qui bouge encore.\r
diff --git a/README.cygwin_mingw b/README.cygwin_mingw
new file mode 100644 (file)
index 0000000..aac9648
--- /dev/null
@@ -0,0 +1,212 @@
+Glut then!\r
+\r
+By Jean-Seb on Friday July 10, 2009, 00:18\r
+Translated by Babelfish with a scrub from John F. Fay.  For points of confusion\r
+please refer to the original French version.\r
+\r
+Freeglut is an open-source evolution of GLUT.\r
+Under Windows, one can use it with Cygwin.\r
+Easy? Yes, if one agrees to distribute "cygwin1.dll".\r
+Let us help freeglut gain its independence !\r
+m.à.j 10/7/2009: generation of a library for linking without the DLL.\r
+\r
+\r
+Recovery of the sources\r
+\r
+    * Download the sources of version 2.6.0 which integrates recent changes.\r
+    * For the moment, it is a RC (Release Candidate), but the final version\r
+      should not delay.\r
+    * The use of the 2.6 is preferable with the 2.4-stable branch because many\r
+      bugs have been corrected.\r
+    * You will find the sources on the site of Freeglut:\r
+          o http://freeglut.sourceforge.net/\r
+\r
+\r
+Objectives and preparation\r
+Objectives\r
+\r
+    * We will create a DLL related to Cygwin, and an independent static library\r
+    * We will also create a dynamic library, allowing linking with the DLL.\r
+\r
+\r
+List of generated files\r
+\r
+    * freeglut.dll: a traditional DLL for the dynamic linkage.\r
+    * libfreeglut.a: the static library. The final program is autonomous (at\r
+      least for OpenGL).\r
+    * libfreeglutdll.a: the dynamic library. The final program needs\r
+      freeglut.dll.\r
+\r
+\r
+Preparation\r
+\r
+    * Extract the files from the freeglut archive.\r
+    * Go in the directory src (located at the root of the Freeglut directory),\r
+      and create a "Gl" sub-directory\r
+          o In this sub-directory, copy the files of the directory "include/Gl"\r
+\r
+    * Why is it necessary to create a "Gl" directory for compilation?\r
+          o I needed it to simplify things during my tests.\r
+          o If not you can create the repertories directly, and copy the files\r
+            as indicated in the point installation (see below).\r
+\r
+    * Do a little housekeeping in /lib:\r
+          o Erase all the references to the glut, so as not to conflict with the\r
+            linking.\r
+          o This stage is optional, you can also choose to do the housekeeping\r
+            only after a successful compilation of Freeglut.\r
+          o In your enthusiasm to clean things up, be careful not to erase the\r
+            library glu32.lib (not to be confused with glut32.lib).\r
+\r
+\r
+Compilation\r
+\r
+    * Forget the "./configure, make, make install" triptych.\r
+          o It does not go at all with Cygwin.\r
+\r
+    * Here Makefile which will make the deal:\r
+\r
+#Makefile for Freeglut 2.6.0-rc and Cygwin\r
+#To place in the directory \93src\94\r
+\r
+sources=$ (wildcard *.c)\r
+objs=$ (sources: .c=.o)\r
+libname=freeglut\r
+\r
+\r
+CFLAGS=-O2 - DTARGET_HOST_MS_WINDOWS - DX_DISPLAY_MISSING - DFREEGLUT_STATIC - I./\r
+LDFLAGS=-lopengl32 - lgdi32 - lwinmm\r
+\r
+nocyg=-mno-cygwin - mwindows\r
+\r
+all: $ (objs)\r
+        #construction DLL related to cygwin1.dll\r
+        GCC $ (nocyg) $ (objs) - shared $ (LDFLAGS) - O $ (libname) .dll\r
+        Nm $ (libname) .dll  | awk \93BEGIN {print \93EXPORTS\94} /T _glut/{sub (/^.*T _/,\94 \ T "); print}\94 > $ (libname) .def\r
+        dlltool --dllname $ (libname) .dll --input-def $ (libname) .def --output-lib lib$ (libname) dll.a\r
+\r
+        #construction static library independent of cygwin\r
+        rear Cr lib$ (libname) .a $ (objs)\r
+        #pas inevitably obligatory (creation of an index to accelerate the accesses)\r
+        ranlib lib$ (libname) .a\r
+\r
+%.o: %.c\r
+        GCC $ (nocyg) - C $ (CFLAGS) $<\r
+\r
+clean:\r
+        rm - F *.o $ (libname) .dll $ (libname) .def lib$ (libname) dll.a lib$ (libname) .a\r
+\r
+\r
+\r
+\r
+Some remarks on the makefile\r
+\r
+    * This makefile creates a DLL, a static library (a file, in other words) and\r
+      the dynamic library which will allow the use of the DLL.\r
+\r
+    * Do not try to strip the static library! You may not be able to compile\r
+      applications with static library any more.\r
+          o On the other hand, you can strip the final executable obtained after\r
+            compiling your application.\r
+\r
+    * I chose to call the DLL and the libraries by their "true names":\r
+      freeglut.dll libfreeglutdll.a and libfreeglut.a.\r
+          o Script configures recreated (for reasons of compatibility with the\r
+            old GLUT library) glut.dll and libglut.a.\r
+          o During the my tests, I had conflicts with an authentic "glut" which\r
+            trailed in my "/lib". I decided to call the things by their name, in\r
+            order to avoid confusions.\r
+          o Nothing prevents you from renaming the DLL, if you need to use GLUT\r
+            programs which you cannot recompile.\r
+\r
+    * The dynamic library is generated starting from the DLL.\r
+          o For reasons of brevity, I used awk. It generates the export file\r
+            used by dlltool.\r
+          o The only notable thing is the selection of the functions whose name\r
+            starts with _glut, in order to avoid including in the dynamic\r
+            library the functions that are not related to freeglut.\r
+          o then, one uses dlltool in a very traditional way.\r
+\r
+Nm $ (libname) .dll  | awk \93BEGIN {print \93EXPORTS\94} /T _glut/{sub (/^.*T _/,\94 \ T "); print}\94 > $ (libname) .def\r
+dlltool --dllname $ (libname) .dll --input-def $ (libname) .def --output-lib lib$ (libname) dll.a\r
+\r
+\r
+\r
+\r
+Installation\r
+\r
+    * Copy libfreeglut.a, libfreeglutdll.a into the Cygwin directory /lib.\r
+    * Copy freglut.dll in the system32 of Windows (this is practical, but not\r
+      clean!).\r
+    * Copy the files headers of Freeglut (/include/gl) into the Cygwin directory\r
+      /usr/include/Gl.\r
+    * Copy the files headers (always /include/gl) into /usr/include/mingw/Gl:\r
+      this is used for compilations with the flag - mno-cygwin, which uses the\r
+      includes in mingw.\r
+          o You may need to erase the old GLUT include files if you installed it\r
+            with Cygwin.\r
+\r
+\r
+Use of the library\r
+\r
+    * We will test with the program shapes, found in progs/demonstrations/shapes\r
+          o -mno-cygwin is used to force the use of Mingw without the large\r
+            dependence cygwin1.dll.\r
+          o -mwindows is only used to remove the horrible Shell window (very\r
+            useful for the settling, on the other hand).\r
+          o -L. (note the period after the "L"): I left libfreeglut.a,\r
+            libfreeglutdll.a and freeglut.dll in the test directory, at the time \r
+            of the tests.\r
+\r
+\r
+Compilation of the static freeglut library, without cygwin\r
+\r
+    * All the simplicity lies in the define: -DFREEGLUT_STATIC\r
+          o It serves to obtain good decoration of the function names in the\r
+            imports of the lib Freeglut.\r
+          o You can test without and use a hex editor to see the differences\r
+            in the objects.\r
+    * attention with the order of the libraries: -lfreeglut (static) must be\r
+      before the declaration of the dynamic libraries.\r
+\r
+    * gcc shapes.c -L. -lfreeglut -lopengl32 -lwinmm -lgdi32 -mno-cygwin -mwindows -DFREEGLUT_STATIC\r
+\r
+\r
+Compilation with DLL freeglut, without cygwin\r
+\r
+    * For the define, see the notices above\r
+    * The order of the libraries is no longer important.\r
+\r
+    * gcc shapes.c -L. -lopengl32 -lwinmm -lgdi32 -lfreeglut -mno-cygwin -DFREEGLUT_STATIC\r
+\r
+\r
+Compilation with DLL freeglut, Cygwin\r
+\r
+    * This example is given only for reference, the topic of this ticket being\r
+      to get rid of Cygwin.\r
+          o Let us say that can be used to make the point (and later).\r
+\r
+    * gcc shapes.c -L. -lopengl32 -lwinmm -lgdi32 -lfreeglut\r
+\r
+\r
+\r
+Where are the dooooocs?\r
+\r
+    * Freeglut is delivered with its documentation, more very up to date.\r
+          o It seems that there is a problem with the original GLUT\r
+            documentation. Not only it does not correspond completely to the\r
+            operation of Freeglut, but moreover, its author (Mark Kilgard)\r
+            copyrighted it. Its distribution is thus difficult.\r
+\r
+    * Jocelyn Fréchot undertook a levelling of the docs for version 2.6.0. One can find them on his site for the moment:\r
+          o http://jocelyn.frechot.free.fr/freeglut/\r
+\r
+\r
+Something survived\85\r
+\r
+    * I also tested the recompiling of the demonstrations of the original lib\r
+      GLUT (peace with its ashes).\r
+          o Nothing in particular to be announced.\r
+\r
+    * Thank you with all the courageous maintainers for Freeglut, that one\r
+      believed dead, but which still move.\r