README.commits
1 GLib is part of the GNOME git repository. At the current time, any
2 person with write access to the GNOME repository, can make changes to
3 GLib. This is a good thing, in that it encourages many people to work
4 on GLib, and progress can be made quickly. However, GLib is a fairly
5 large and complicated package that many other things depend on, so to
6 avoid unnecessary breakage, and to take advantage of the knowledge
7 about GLib that has been built up over the years, we'd like to ask
8 people committing to GLib to follow a few rules:
9
10 0) Ask first. If your changes are major, or could possibly break existing
11 code, you should always ask. If your change is minor and you've
12 been working on GLib for a while it probably isn't necessary
13 to ask. But when in doubt, ask. Even if your change is correct,
14 somebody may know a better way to do things.
15
16 If you are making changes to GLib, you should be subscribed
17 to gtk-devel-list (a] gnome.org. (Subscription address:
18 gtk-devel-list-request (a] gnome.org.) This is a good place to ask
19 about intended changes.
20
21 #gtk+ on GIMPNet (irc.gimp.org, irc.us.gimp.org, irc.eu.gimp.org, ...)
22 is also a good place to find GTK+ developers to discuss changes with,
23 however, email to gtk-devel-list is the most certain and preferred
24 method.
25
26 1) Ask _first_.
27
28 2) With git, we no longer maintain a ChangeLog file, but you are expected
29 to produce a meaningful commit message. Changes without a sufficient
30 commit message will be reverted. See below for the expected format
31 of commit messages.
32
33 Notes:
34
35 * When developing larger features or complicated bug fixes, it is
36 advisable to work in a branch in your own cloned GLib repository.
37 You may even consider making your repository publically available
38 so that others can easily test and review your changes.
39
40 * The expected format for git commit messages is as follows:
41
42 === begin example commit ===
43 Short explanation of the commit
44
45 Longer explanation explaining exactly what's changed, whether any
46 external or private interfaces changed, what bugs were fixed (with bug
47 tracker reference if applicable) and so forth. Be concise but not too brief.
48 === end example commit ===
49
50 - Always add a brief description of the commit to the _first_ line of
51 the commit and terminate by two newlines (it will work without the
52 second newline, but that is not nice for the interfaces).
53
54 - First line (the brief description) must only be one sentence and
55 should start with a capital letter unless it starts with a lowercase
56 symbol or identifier. Don't use a trailing period either. Don't exceed
57 72 characters.
58
59 - The main description (the body) is normal prose and should use normal
60 punctuation and capital letters where appropriate. Normally, for patches
61 sent to a mailing list it's copied from there.
62
63 - When committing code on behalf of others use the --author option, e.g.
64 git commit -a --author "Joe Coder <joe (a] coder.org>" and --signoff.
65
66
67 Owen Taylor
68 13 Aug 1998
69 17 Apr 2001
70
71 Matthias Clasen
72 31 Mar 2009
73
README.in
1 General Information
2 ===================
3
4 This is GLib version @GLIB_VERSION@. GLib is the low-level core
5 library that forms the basis for projects such as GTK+ and GNOME. It
6 provides data structure handling for C, portability wrappers, and
7 interfaces for such runtime functionality as an event loop, threads,
8 dynamic loading, and an object system.
9
10 The official ftp site is:
11 ftp://ftp.gtk.org/pub/glib
12
13 The official web site is:
14 http://www.gtk.org/
15
16 Information about mailing lists can be found at
17 http://www.gtk.org/mailinglists.html
18
19 To subscribe: mail -s subscribe gtk-list-request (a] gnome.org < /dev/null
20 (Send mail to gtk-list-request (a] gnome.org with the subject "subscribe")
21
22 Installation
23 ============
24
25 See the file 'INSTALL'
26
27 Notes about GLib 2.20
28 =====================
29
30 ^ The functions for launching applications (e.g. g_app_info_launch() +
31 friends) now passes a FUSE file:// URI if possible (requires gvfs
32 with the FUSE daemon to be running and operational). With gvfs 2.26,
33 FUSE file:// URIs will be mapped back to gio URIs in the GFile
34 constructors. The intent of this change is to better integrate
35 POSIX-only applications, see bug #528670 for the rationale. The
36 only user-visible change is when an application needs to examine an
37 URI passed to it (e.g. as a positional parameter). Instead of
38 looking at the given URI, the application will now need to look at
39 the result of g_file_get_uri() after having constructed a GFile
40 object with the given URI.
41
42 Notes about GLib 2.18
43 =====================
44
45 * The recommended way of using GLib has always been to only include the
46 toplevel headers glib.h, glib-object.h and gio.h. GLib enforces this by
47 generating an error when individual headers are directly included.
48 To help with the transition, the enforcement is not turned on by
49 default for GLib headers (it is turned on for GObject and GIO).
50 To turn it on, define the preprocessor symbol G_DISABLE_SINGLE_INCLUDES.
51
52 Notes about GLib 2.16
53 =====================
54
55 * GLib now includes GIO, which adds optional dependencies against libattr
56 and libselinux for extended attribute and SELinux support. Use
57 --disable-xattr and --disable-selinux to build without these.
58
59 Notes about GLib 2.10
60 =====================
61
62 * The functions g_snprintf() and g_vsnprintf() have been removed from
63 the gprintf.h header, since they are already declared in glib.h. This
64 doesn't break documented use of gprintf.h, but people have been known
65 to include gprintf.h without including glib.h.
66
67 * The Unicode support has been updated to Unicode 4.1. This adds several
68 new members to the GUnicodeBreakType enumeration.
69
70 * The support for Solaris threads has been retired. Solaris has provided
71 POSIX threads for long enough now to have them available on every
72 Solaris platform.
73
74 * 'make check' has been changed to validate translations by calling
75 msgfmt with the -c option. As a result, it may fail on systems with
76 older gettext implementations (GNU gettext < 0.14.1, or Solaris gettext).
77 'make check' will also fail on systems where the C compiler does not
78 support ELF visibility attributes.
79
80 * The GMemChunk API has been deprecated in favour of a new 'slice
81 allocator'. See the g_slice documentation for more details.
82
83 * A new type, GInitiallyUnowned, has been introduced, which is
84 intended to serve as a common implementation of the 'floating reference'
85 concept that is e.g. used by GtkObject. Note that changing the
86 inheritance hierarchy of a type can cause problems for language
87 bindings and other code which needs to work closely with the type
88 system. Therefore, switching to GInitiallyUnowned should be done
89 carefully. g_object_compat_control() has been added to GLib 2.8.5
90 to help with the transition.
91
92 Notes about GLib 2.6.0
93 ======================
94
95 * GLib 2.6 introduces the concept of 'GLib filename encoding', which is the
96 on-disk encoding on Unix, but UTF-8 on Windows. All GLib functions
97 returning or accepting pathnames have been changed to expect
98 filenames in this encoding, and the common POSIX functions dealing
99 with pathnames have been wrapped. These wrappers are declared in the
100 header <glib/gstdio.h> which must be included explicitly; it is not
101 included through <glib.h>.
102
103 On current (NT-based) Windows versions, where the on-disk file names
104 are Unicode, these wrappers use the wide-character API in the C
105 library. Thus applications can handle file names containing any
106 Unicode characters through GLib's own API and its POSIX wrappers,
107 not just file names restricted to characters in the system codepage.
108
109 To keep binary compatibility with applications compiled against
110 older versions of GLib, the Windows DLL still provides entry points
111 with the old semantics using the old names, and applications
112 compiled against GLib 2.6 will actually use new names for the
113 functions. This is transparent to the programmer.
114
115 When compiling against GLib 2.6, applications intended to be
116 portable to Windows must take the UTF-8 file name encoding into
117 consideration, and use the gstdio wrappers to access files whose
118 names have been constructed from strings returned from GLib.
119
120 * Likewise, g_get_user_name() and g_get_real_name() have been changed
121 to return UTF-8 on Windows, while keeping the old semantics for
122 applications compiled against older versions of GLib.
123
124 * The GLib uses an '_' prefix to indicate private symbols that
125 must not be used by applications. On some platforms, symbols beginning
126 with prefixes such as _g will be exported from the library, on others not.
127 In no case can applications use these private symbols. In addition to that,
128 GLib+ 2.6 makes several symbols private which were not in any installed
129 header files and were never intended to be exported.
130
131 * To reduce code size and improve efficiency, GLib, when compiled
132 with the GNU toolchain, has separate internal and external entry
133 points for exported functions. The internal names, which begin with
134 IA__, may be seen when debugging a GLib program.
135
136 * On Windows, GLib no longer opens a console window when printing
137 warning messages if stdout or stderr are invalid, as they are in
138 "Windows subsystem" (GUI) applications. Simply redirect stdout or
139 stderr if you need to see them.
140
141 * The child watch functionality tends to reveal a bug in many
142 thread implementations (in particular the older LinuxThreads
143 implementation on Linux) where it's not possible to call waitpid()
144 for a child created in a different thread. For this reason, for
145 maximum portability, you should structure your code to fork all
146 child processes that you want to wait for from the main thread.
147
148 * A problem was recently discovered with g_signal_connect_object();
149 it doesn't actually disconnect the signal handler once the object being
150 connected to dies, just disables it. See the API docs for the function
151 for further details and the correct workaround that will continue to
152 work with future versions of GLib.
153
154 How to report bugs
155 ==================
156
157 Bugs should be reported to the GNOME bug tracking system.
158 (http://bugzilla.gnome.org, product glib.) You will need
159 to create an account for yourself.
160
161 In the bug report please include:
162
163 * Information about your system. For instance:
164
165 - What operating system and version
166 - For Linux, what version of the C library
167
168 And anything else you think is relevant.
169
170 * How to reproduce the bug.
171
172 If you can reproduce it with one of the test programs that are built
173 in the tests/ subdirectory, that will be most convenient. Otherwise,
174 please include a short test program that exhibits the behavior.
175 As a last resort, you can also provide a pointer to a larger piece
176 of software that can be downloaded.
177
178 * If the bug was a crash, the exact text that was printed out
179 when the crash occured.
180
181 * Further information such as stack traces may be useful, but
182 is not necessary.
183
184 Patches
185 =======
186
187 Patches should also be submitted to bugzilla.gnome.org. If the
188 patch fixes an existing bug, add the patch as an attachment
189 to that bug report.
190
191 Otherwise, enter a new bug report that describes the patch,
192 and attach the patch to that bug report.
193
194 Bug reports containing patches should include the PATCH keyword
195 in their keyword fields. If the patch adds to or changes the GLib
196 programming interface, the API keyword should also be included.
197
198 Patches should be in unified diff form. (The -u option to GNU
199 diff.)
200
README.win32
1 Tor Lillqvist <tml (a] iki.fi>
2 Hans Breuer <hans (a] breuer.org>
3
4 The general parts, and the section about gcc and autoconfiscated build
5 are by Tor Lillqvist. The sections about MSVC build is by Hans Breuer.
6
7 General
8 =======
9
10 For prebuilt binaries (DLLs and EXEs) and developer packages (headers,
11 import libraries) of GLib, Pango, GTK+ etc for Windows, go to
12 http://www.gtk.org/download-windows.html . They are for "native"
13 Windows meaning they use the Win32 API and Microsoft C runtime library
14 only. No POSIX (Unix) emulation layer like Cygwin in involved.
15
16 To build GLib on Win32, you can use either gcc ("mingw") or the
17 Microsoft compiler and tools. For the latter, MSVC6 and later have
18 been used successfully. Also the Digital Mars C/C++ compiler have been
19 used.
20
21 People have also successfully cross-compiled GLib for Win32 from Linux
22 using the cross-mingw packages.
23
24 Note that to just *use* GLib on Windows, there is no need to build it
25 yourself.
26
27 On Windows setting up a correct build environment can be quite a task,
28 especially if you are used to just type "./configure; make" on Linux,
29 and expect things to work as smoothly on Windows.
30
31 The following preprocessor macros are to be used for conditional
32 compilation related to Win32 in GLib-using code:
33
34 - G_OS_WIN32 is defined when compiling for native Win32, without
35 any POSIX emulation, other than to the extent provided by the
36 bundled Microsoft C library (msvcr*.dll).
37
38 - G_WITH_CYGWIN is defined if compiling for the Cygwin
39 environment. Note that G_OS_WIN32 is *not* defined in that case, as
40 Cygwin is supposed to behave like Unix. G_OS_UNIX *is* defined by a GLib
41 for Cygwin.
42
43 - G_PLATFORM_WIN32 is defined when either G_OS_WIN32 or G_WITH_CYGWIN
44 is defined.
45
46 These macros are defined in glibconfig.h, and are thus available in
47 all source files that include <glib.h>.
48
49 Additionally, there are the compiler-specific macros:
50 - __GNUC__ is defined when using gcc
51 - _MSC_VER is defined when using the Microsoft compiler
52 - __DMC__ is defined when using the Digital Mars C/C++ compiler
53
54 G_OS_WIN32 implies using the Microsoft C runtime, normally
55 msvcrt.dll. GLib is not known to work with the older crtdll.dll
56 runtime, or the static Microsoft C runtime libraries libc.lib and
57 libcmt.lib. It apparently does work with the debugging version of
58 msvcrt.dll, msvcrtd.dll. If compiled with Microsoft compilers newer
59 than MSVC6, it also works with their compiler-specific runtimes, like
60 msvcr70.dll or msvcr80.dll. Please note that it's non totally clear if
61 you would be allowed by the license to distrubute a GLib linked to
62 msvcr70.dll or msvcr80.dll, as those are not part of the operating
63 system, but of the MSVC product. msvcrt.dll is part of Windows.
64
65 Building software that use GLib or GTK+
66 =======================================
67
68 Building software that just *uses* GLib or GTK+ also require to have
69 the right compiler set up the right way. If you intend to use gcc,
70 follow the relevant instructions below in that case, too.
71
72 Tor uses gcc with the -mms-bitfields flag which means that in order to
73 use the prebuilt DLLs (especially of GTK+), if you compile your code
74 with gcc, you *must* also use that flag. This flag means that the
75 struct layout rules are identical to those used by MSVC. This is
76 essential if the same DLLs are to be usable both from gcc- and
77 MSVC-compiled code. Such compatibility is desirable.
78
79 When using the prebuilt GLib DLLs that use msvcrt.dll from code that
80 uses other C runtimes like for example msvcr70.dll, one should note
81 that one cannot use such GLib API that take or returns file
82 descriptors. On Windows, a file descriptor (the small integer as
83 returned by open() and handled by related functions, and included in
84 the FILE struct) is an index into a table local to the C runtime
85 DLL. A file descriptor in one C runtime DLL does not have the same
86 meaning in another C runtime DLL.
87
88 Building GLib
89 =============
90
91 Again, first decide whether you really want to do this.
92
93 Before building GLib you must also have a GNU gettext-runtime
94 developer package. Get prebuilt binaries of gettext-runtime from
95 http://www.gtk.org/download-windows.html .
96
97 Autoconfiscated build (with gcc)
98 ================================
99
100 Tor uses gcc 3.4.5 and the rest of the mingw utilities, including MSYS
101 from www.mingw.org. Somewhat earlier or later versions of gcc
102 presumably also work fine.
103
104 Using Cygwin's gcc with the -mno-cygwin switch is not recommended. In
105 theory it should work, but Tor hasn't tested that lately. It can
106 easily lead to confusing situations where one mixes headers for Cygwin
107 from /usr/include with the headers for native software one really
108 should use. Ditto for libraries.
109
110 If you want to use mingw's gcc, install gcc, win32api, binutils and
111 MSYS from www.mingw.org.
112
113 Tor invokes configure using:
114
115 CC='gcc -mtune=pentium3 -mthreads' CPPFLAGS='-I/opt/gnu/include' \
116 LDFLAGS='-L/opt/gnu/lib -Wl,--enable-auto-image-base' CFLAGS=-O2 \
117 ./configure --disable-gtk-doc --prefix=$TARGET
118
119 The /opt/gnu mentioned contains the header files for GNU and (import)
120 libraries for GNU libintl. The build scripts used to produce the
121 prebuilt binaries are included in the "dev" packages.
122
123 Please note that the ./configure mechanism should not blindly be used
124 to build a GLib to be distributed to other developers because it
125 produces a compiler-dependent glibconfig.h. For instance, the typedef
126 for gint64 is long long with gcc, but __int64 with MSVC.
127
128 Except for this and a few other minor issues, there shouldn't be any
129 reason to distribute separate GLib headers and DLLs for gcc and MSVC6
130 users, as the compilers generate code that uses the same C runtime
131 library.
132
133 The DLL generated by either compiler is binary compatible with the
134 other one. Thus one either has to manually edit glibconfig.h
135 afterwards, or use the supplied glibconfig.h.win32 which has been
136 produced by running configure twice, once using gcc and once using
137 MSVC, and merging the resulting files with diff -D.
138
139 For MSVC7 and later (Visual C++ .NET 2003, Visual C++ 2005, Visual C++
140 2008 etc) it is preferred to use specific builds of GLib DLLs that use
141 the same C runtime as the code that uses GLib. Such DLLs should be
142 named differently than the ones that use msvcrt.dll.
143
144 For GLib, the DLL is called libglib-2.0-0.dll, and the import
145 libraries libglib-2.0.dll.a and glib-2.0.lib. Note that the "2.0" is
146 part of the "basename" of the library, it is not something that
147 libtool has added. The -0 suffix is added by libtool and is the value
148 of "LT_CURRENT - LT_AGE". The 0 is *not* part of the version number of
149 GLib, although, for GLib 2.x.0, it happens to be the same. The
150 LT_CURRENT - LT_AGE value will on purpose be kept as zero as long as
151 binary compatibility is maintained. For the gory details, see
152 configure.in and libtool documentation.
153
154 Cross-compiling
155 ===============
156
157 It is possible to build GLib using a cross compiler. See
158 docs/reference/glib/html/glib-cross-compiling.html (part of the GLib
159 reference manual) for more information.
160
161 Building with MSVC
162 ==================
163
164 If you are building from a SVN snapshot, you will not have any
165 makefile.msc files. You should copy the corresponding makefile.msc.in
166 file to that name, and replace any @...@ strings with the correct
167 value.
168
169 This is done automatically when an official GLib source distribution
170 package is built, so if you get GLib from a source distribution
171 package, there should be makefile.msc files ready to use (after some
172 editing).
173
174 The hand-written makefile.msc files, and the stuff in the "build"
175 subdirectory, produce DLLs and import libraries that match what the
176 so-called autoconfiscated build produces.
177
178 All the MSVC makefiles are for the command line build with nmake. If
179 you want to use the VC-UI you can simply create wrapper .dsp makefiles
180 (read the VC docs how to do so).
181
182 Some modules may require Perl to auto-generate files. The goal (at
183 least Hans's) is to not require any more tools.
184
185 Build with:
186
187 nmake -f makefile.msc
188 or
189 nmake -f makefile.msc DEBUG=1
190
191 [
192 The former will create 'release' versions of the DLLs. If you
193 plan to distribute you DLLs please use this command. The latter
194 will create DLLs with debug information _and_ link them with
195 msvcrtd.dll instead of msvcrt.dll.
196 Beware: There are known problems with mixing DLLs in one
197 application, which are build against different runtimes.
198 Especially the index-to-file mapping used by 'unix-style' file
199 operation - _open() _pipe() etc. - breaks sometimes in strange
200 ways (for example the Gimp plug-in communication).
201 ]
202
203 Required libraries (not build from svn)
204 ------------------
205 libintl (gnu-intl),
206
207 are available pre-built from the website mentioned above.
208
209 Versioning
210 ----------
211 Instead of the Unix and auto* way of tracking versions and resolving
212 dependencies (configure; make; make install) involving autoconf,
213 automake, libtool and friends the MSVC build uses a different
214 approach.
215
216 The core of it's versioning is the file build/win32/module.defs.
217 It contains entries of the form MODULE_VER, e.g.:
218
219 GLIB_VER = 2.0
220 LIBICONV_VER = 1.3
221
222 and the placement of these modules defined as MODULE, e.g.:
223
224 GLIB = $(TOP)/glib
225 LIBICONV = $(TOP)/libiconv-$(LIBICONV_VER)
226
227 whereas TOP is defined as the relative path from the respective
228 module directory to your top build directory. Every makefile.msc
229 needs to define TOP before including the common make file part
230 make.msc, which than includes module.defs, like:
231
232 TOP = ../..
233 !INCLUDE $(TOP)/glib/build/win32/make.msc
234
235 (Taken from gtk+/gdk/makefile.msc)
236
237 With this provision it is possible to create almost placement
238 independent makefiles without requiring to 'install' the libraries and
239 headers into a common place (as it is done on Unix, and as Tor does
240 when producing his zipfiles with prebuilt GLib, GTK+ etc).
241
242 Special Files
243 -------------
244 config.h.win32.in : @XXX_MAJOR_VERSION@ needs to be replaced by
245 the current version/build number. The resulting file is to be saved
246 as 'config.h.win32'. This should be automatically done if a package
247 gets build on the Unix platform.
248
249 makefile.msc.in : @XXX_MAJOR_VERSION@ to be replaced. Save as
250 makefile.msc.
251
252 <module>.def : every function which should be used from the outside of
253 a dll needs to be marked for 'export'. It is common that one needs to change
254 these files after some api changes occured. If there are variables to be
255 exported another mechanism is needed, like :
256
257 #ifdef G_OS_WIN32
258 # ifdef GDK_COMPILATION
259 # define GDKVAR __declspec(dllexport)
260 # else
261 # define GDKVAR extern __declspec(dllimport)
262 # endif
263 #else
264 # define GDKVAR extern
265 #endif
266
267
268
269 Directory Structure
270 -------------------
271 all modules should be build in a common directory tree otherwise you
272 need to adapt the file 'module.defs'. They are listed here in increasing
273 dependencies order.
274
275 <common rootdir without spaces>
276 |
277 +- glib
278 | |
279 | +- build : [this module lives in the SVN root dir]
280 | | +- win32
281 | | .\module.defs : defines (relative) locations of the headers
282 | | and libs and version numbers to be include
283 | | in dll names
284 | | .\make.msc : include by almost every 'makefile.msc'
285 | |
286 | | .\README.WIN32 : more information how to build
287 | | .\glibconfig.h.win32.in : similar to config.h.win32.in
288 | | .\makefile.msc : master makefile, sub dir makefiles should work
289 | |
290 | +- glib
291 | +- gmodule
292 | +- gthread : does _not_ depend on pthread anymore
293 | +- gobject
294 |
295 +- pango
296 | +- pango : 'native' build does not require extra libs and
297 | | includes the minimal required text renderer
298 | | (there is also a currently slightly broken FreeType2
299 | | based implementation for win32)
300 | +- modules (not yet build)
301 |
302 +- atk
303 | +- atk
304 | .\makefile.msc : build here
305 |
306 +- gtk+
307 | | .\config.h.win32 : for all the below
308 | |
309 | +- gdk-pixbuf
310 | | .\gdk_pixbuf.rc.in : version resource for the DLLs. Needs
311 | | to be converted (filled with version info)
312 | | as described above.
313 | |
314 | +- gdk
315 | | | .\makefile.msc : some auto-generation is needed to build in the
316 | | | in the subdirectory
317 | | +- win32
318 | |
319 | +- gtk
320
321 |
322 +- gimp
323 | .\makefile.msc : master makefile to build The Gimp. The makefiles
324 | from the sub dirs should work stand alone, but than
325 | the user needs to know the build order
326
327 |
328 +- dia : additionally depends on libart_lgpl (in SVN)
329 | and libxml2 ( see http://www.xmlsoft.org/ )
330 +- lib
331 +- app
332 +- objects
333 +- plug-ins
334 +- python
335
336