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