? alloc-msvc-syntax.patch ? config.h ? findme.patch ? makefile.msc ? parse.patch ? pkg.patch ? popt.patch ? poptconfig.patch ? poptconfig.pathc ? popthelp.patch ? poptparse.patch Index: ChangeLog =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/ChangeLog,v retrieving revision 1.65 diff -r1.65 ChangeLog 0a1,9 > 2004-07-25 Todd A. Fisher > Added support for systems without alloca as well as > conditionally including malloc.h for win32. > > * makefile.msc: added support for msvc > * pkg.c: cleaned up warnings about unused variables > * parse.c: added library name file system check for win32 target > Index: findme.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/findme.c,v retrieving revision 1.4 diff -r1.4 findme.c 26c26,30 < # include --- > # ifdef _MSC_VER > # include > # else > # include > # endif 55c59,60 < char * buf; --- > char * buf, *free_ptr; > int path_len = strlen( path ); 64,65c69,74 < start = pathbuf = alloca(strlen(path) + 1); < buf = malloc(strlen(path) + strlen(argv0) + 2); --- > #ifdef HAVE_ALLOCA_H > start = pathbuf = alloca(path_len + 1); > #else > free_ptr = start = pathbuf = g_strdup( path ); > #endif > buf = malloc(path_len + strlen(argv0) + 2); 84a94,95 > free( free_ptr ); > Index: parse.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/parse.c,v retrieving revision 1.14 diff -r1.14 parse.c 42a43,95 > static > gchar *canonicalize_path( const char *path, int len ) > { > int i; > gchar *comp; > > if( msvc_syntax ){ // windows style path seperators > comp = (char*)g_malloc( len + 1 ); > for( i = 0; i < len; ++i ) > { > if( path[i] == '/' ){ > comp[i] = '\\'; > } > else > comp[i] = path[i]; > } > comp[i] = '\0'; > } > else{ // unix style path seperators > int offset = 0; > int rlen; > const gchar *start = g_path_skip_root( path ); // requires absolute path > > if( start ){ > rlen = len -= start - path; > #ifdef WIN32 // cygwin style > offset = strlen( "/cygdrive/" )+2; > len += offset + 3; // windows need extra space for the drive letter cygwin style > #endif > > comp = (char*)g_malloc( len + 1 ); > #ifdef WIN32 > strcpy( comp, "/cygdrive/" ); > comp[offset-2] = tolower( path[0] ); // get the drive letter > comp[offset-1] = '/'; > #endif > for( i = 0; i < rlen; ++i ) > { > if( start[i] == '\\' ){ > comp[i+offset] = '/'; > } > else > comp[i+offset] = start[i]; > } > comp[i+offset] = '\0'; > } > else > return g_strndup( path, len ); // risk it > } > return comp; > } > > 568,569c621,622 < GSList *parsed; < GSList *iter; --- > // GSList *parsed; > // GSList *iter; 583a637,685 > #ifdef G_OS_WIN32 > /* walk through each directory listed in LIB to determine > * if the library should be prefixed with lib or not > */ > static gboolean > lib_suffix_needed( const char *base_lib_name, const char *lib_suffix ) > { > const gchar *libpath = g_getenv( "LIB" ); > if( libpath ){ > gchar **lib_paths = g_strsplit( libpath, ";", -1 ); > gchar **path_iter; > // g_print( "processing the LIB environment variable: %s\n", libpath ); > > for( path_iter = lib_paths; *path_iter; ++path_iter ){ > gchar *base = g_strconcat( base_lib_name, lib_suffix, NULL ); > gchar *path = g_build_filename( *path_iter, base, NULL ); > > // g_print( "\tchecking path: %s\n", path ); > > if( g_file_test( path, G_FILE_TEST_EXISTS ) ){ > g_free( path ); > g_free( base ); > return FALSE; > } > g_free( path ); > g_free( base ); > base = g_strconcat( "lib", base_lib_name, lib_suffix, NULL ); > > /* test it with the lib prefix */ > path = g_build_filename( *path_iter, base, NULL ); > // g_print( "\tchecking path: %s\n", path ); > > if( g_file_test( path, G_FILE_TEST_EXISTS ) ){ > g_free( path ); > g_free( base ); > return TRUE; > } > > g_free( path ); > g_free( base ); > > } > > g_strfreev( lib_paths ); > } > return FALSE; > } > #endif > 597a700 > char *lib_prefix = NULL; //(msvc_syntax ? "lib" : ""); 601a705 > char *lib_prefix = NULL; //""; 646,647c750,756 < libname = g_strndup (start, p - start); < --- > libname = canonicalize_path( start, p - start );//g_strndup (start, p - start); > #ifdef G_OS_WIN32 > if( msvc_syntax && lib_suffix_needed( libname, lib_suffix ) ) > lib_prefix = g_strdup( "lib" ); > else > lib_prefix = g_strdup( "" ); > #endif 649c758,761 < g_strconcat (l_flag, libname, lib_suffix, NULL)); --- > g_strconcat (l_flag, lib_prefix, libname, lib_suffix, NULL)); > #ifdef G_OS_WIN32 > g_free( lib_prefix ); > #endif 666c778 < libname = g_strndup (start, p - start); --- > libname = canonicalize_path( start, p - start );//g_strndup (start, p - start); 746c858 < libname = g_strndup (start, p - start); --- > libname = canonicalize_path (start, p - start); 771,784c883 < < static void < parse_url (Package *pkg, const char *str, const char *path) < { < if (pkg->url != NULL) < { < verbose_error ("URL field occurs twice in '%s'\n", path); < < exit (1); < } < < pkg->url = trim_and_sub (pkg, str, path); < } < --- > 835,836d933 < else if (strcmp (tag, "URL") == 0) < parse_url (pkg, p, path); 839,845c936,939 < /* we don't error out on unknown keywords because they may < * represent additions to the .pc file format from future < * versions of pkg-config. We do make a note of them in the < * debug spew though, in order to help catch mistakes in .pc < * files. */ < debug_spew ("Unknown keyword '%s' in '%s'\n", < tag, path); --- > verbose_error ("Unknown keyword '%s' in '%s'\n", > tag, path); > > exit (1); 951c1045 < pkg->pcfiledir = g_dirname (path); --- > pkg->pcfiledir = g_path_get_dirname (path); Index: pkg.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/pkg.c,v retrieving revision 1.31 diff -r1.31 pkg.c 29c29,33 < # include --- > # ifdef _MSC_VER > # include > # else > # include > # endif 36a41 > 37a43 > 133c139 < free (dirname_copy); --- > g_free (dirname_copy); 186,205d191 < static Package * < add_virtual_pkgconfig_package (void) < { < Package *pkg = NULL; < < pkg = g_new0 (Package, 1); < < pkg->key = g_strdup ("pkg-config"); < pkg->version = g_strdup (VERSION); < pkg->name = g_strdup ("pkg-config"); < pkg->description = g_strdup ("pkg-config is a system for managing " < "compile/link flags for libraries"); < pkg->url = g_strdup ("http://www.freedesktop.org/software/pkgconfig/"); < < debug_spew ("Adding virtual 'pkg-config' package to list of known packages\n"); < g_hash_table_insert (packages, pkg->key, pkg); < < return pkg; < } < 224,225d209 < add_virtual_pkgconfig_package (); < 677c661,663 < values = g_strsplit (env, G_SEARCHPATH_SEPARATOR_S, 0); --- > /* FIXME: the separator should be a ';' on Windows > */ > values = g_strsplit (env, ":", 0); 719c705 < pkg->key); --- > pkg->name); 726c712 < pkg->key); --- > pkg->description); 753,755d738 < if (req->url) < verbose_error ("You may find new versions of %s at %s\n", < req->name, req->url); 810d792 < #ifndef G_OS_WIN32 812,813c794 < #endif < --- > 876,880d856 < #ifdef PREFER_LIB64 < #define SYSTEM_LIBDIR "/usr/lib64" < #else < #define SYSTEM_LIBDIR "/usr/lib" < #endif 885,886c861,862 < if (strcmp (iter->data, "-L" SYSTEM_LIBDIR) == 0 || < strcmp (iter->data, "-L " SYSTEM_LIBDIR) == 0) --- > if (strcmp (iter->data, "-L/usr/lib") == 0 || > strcmp (iter->data, "-L /usr/lib") == 0) 888c864 < debug_spew ("Package %s has -L" SYSTEM_LIBDIR " in Libs\n", --- > debug_spew ("Package %s has -L/usr/lib in Libs\n", 894c870 < debug_spew ("Removing -L" SYSTEM_LIBDIR " from libs for %s\n", pkg->key); --- > debug_spew ("Removing -L/usr/lib from libs for %s\n", pkg->key); 900d875 < #undef SYSTEM_LIBDIR 952d926 < GSList *tmp; 973d946 < GSList *tmp; 1232a1206 > char * pstr1, * pstr2; 1238c1212 < --- > #ifdef HAVE_ALLOCA_H 1240a1215,1220 > #define CLEANUP > #else > pstr1 = str1 = malloc(strlen(a) + 1); > pstr2 = str2 = malloc(strlen(b) + 1); > #define CLEANUP free( pstr1 ); free( pstr2 ); > #endif 1278,1279c1258,1259 < if (one == str1) return -1; /* arbitrary */ < if (two == str2) return -1; --- > if (one == str1) { CLEANUP return -1; } /* arbitrary */ > if (two == str2) { CLEANUP return -1; } 1291,1292c1271,1272 < if (strlen(one) > strlen(two)) return 1; < if (strlen(two) > strlen(one)) return -1; --- > if (strlen(one) > strlen(two)) { CLEANUP return 1; } > if (strlen(two) > strlen(one)) { CLEANUP return -1; } 1300c1280 < if (rc) return rc; --- > if (rc) { CLEANUP return rc; } 1312c1292 < if ((!*one) && (!*two)) return 0; --- > if ((!*one) && (!*two)) { CLEANUP return 0; } 1315c1295,1297 < if (!*one) return -1; else return 1; --- > if (!*one){ CLEANUP return -1; } else { CLEANUP return 1; } > > CLEANUP Index: popt.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/popt.c,v retrieving revision 1.3 diff -r1.3 popt.c 25c25,29 < # include --- > # ifdef _MSC_VER > # include > # else > # include > # endif 210a215 > #ifdef HAVE_ALLOCA_H 211a217,219 > #else > argv[pos] = malloc(strlen(con->execPath) + strlen(script) + 2); > #endif 219c227,228 < if (argv[pos]) pos++; --- > if (argv[pos]) > pos++; 300a310 > char *free_ptr = 0; 325a336 > #ifdef HAVE_ALLOCA_H 328a340,344 > #define ALLOCA_FREE > #else > free_ptr = localOptString = optString = strdup( origOptString ); > #define ALLOCA_FREE if( free_ptr ) free( free_ptr ); > #endif 330c346,347 < if (!optString[0]) --- > if (!optString[0]){ > ALLOCA_FREE 331a349 > } 357c375,378 < if (!opt && !singleDash) return POPT_ERROR_BADOPT; --- > if (!opt && !singleDash){ > ALLOCA_FREE > return POPT_ERROR_BADOPT; > } 379c400,403 < if (!opt) return POPT_ERROR_BADOPT; --- > if (!opt){ > ALLOCA_FREE > return POPT_ERROR_BADOPT; > } 398c422,423 < if (con->os->next == con->os->argc) --- > if (con->os->next == con->os->argc){ > ALLOCA_FREE 399a425 > } 413c439,440 < if (*end) --- > if (*end) { > ALLOCA_FREE 414a442 > } 416c444,445 < if (aLong == LONG_MIN || aLong == LONG_MAX) --- > if (aLong == LONG_MIN || aLong == LONG_MAX){ > ALLOCA_FREE 417a447 > } 421c451,452 < if (aLong > INT_MAX || aLong < INT_MIN) --- > if (aLong > INT_MAX || aLong < INT_MIN){ > ALLOCA_FREE 422a454 > } 429a462 > ALLOCA_FREE 456a490 > ALLOCA_FREE Index: poptconfig.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/poptconfig.c,v retrieving revision 1.3 diff -r1.3 poptconfig.c 1,24c1,3 < /* < Copyright (c) 1998 Red Hat Software < < Permission is hereby granted, free of charge, to any person obtaining a copy < of this software and associated documentation files (the "Software"), to deal < in the Software without restriction, including without limitation the rights < to use, copy, modify, merge, publish, distribute, sublicense, and/or sell < copies of the Software, and to permit persons to whom the Software is < furnished to do so, subject to the following conditions: < < The above copyright notice and this permission notice shall be included in < all copies or substantial portions of the Software. < < THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR < IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, < FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE < X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN < AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN < CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. < < Except as contained in this notice, the name of the X Consortium shall not be < used in advertising or otherwise to promote the sale, use or other dealings < in this Software without prior written authorization from the X Consortium. < */ --- > /* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING > file accompanying popt source distributions, available from > ftp://ftp.redhat.com/pub/code/popt */ 31c10,14 < # include --- > # ifdef _MSC_VER > # include > # else > # include > # endif 106a90 > char * free_ptr; 118a103 > #ifdef HAVE_ALLOCA_H 119a105,107 > #else > file = malloc( fileLength + 1 ); > #endif 123a112,114 > #ifndef HAVE_ALLOCA_H > free( file ); > #endif 127a119 > #ifdef HAVE_ALLOCA_H 128a121,123 > #else > free_ptr = dst = buf = malloc(fileLength + 1); > #endif 156a152,154 > #ifndef HAVE_ALLOCA_H > free( free_ptr ); > #endif 173a172 > #ifdef HAVE_ALLOCA_H 174a174,176 > #else > fn = malloc(strlen(home) + 20); > #endif 178c180,184 < if (rc) return rc; --- > #ifndef HAVE_ALLOCA_H > free( fn ); > #endif > if (rc) > return rc; Index: popthelp.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/popthelp.c,v retrieving revision 1.3 diff -r1.3 popthelp.c 1,24c1,3 < /* < Copyright (c) 1998 Red Hat Software < < Permission is hereby granted, free of charge, to any person obtaining a copy < of this software and associated documentation files (the "Software"), to deal < in the Software without restriction, including without limitation the rights < to use, copy, modify, merge, publish, distribute, sublicense, and/or sell < copies of the Software, and to permit persons to whom the Software is < furnished to do so, subject to the following conditions: < < The above copyright notice and this permission notice shall be included in < all copies or substantial portions of the Software. < < THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR < IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, < FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE < X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN < AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN < CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. < < Except as contained in this notice, the name of the X Consortium shall not be < used in advertising or otherwise to promote the sale, use or other dealings < in this Software without prior written authorization from the X Consortium. < */ --- > /* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING > file accompanying popt source distributions, available from > ftp://ftp.redhat.com/pub/code/popt */ 31c10,14 < # include --- > # ifdef _MSC_VER > # include > # else > # include > # endif 87c70 < char * left = alloca(maxLeftCol + 1); --- > char * left; 88a72,78 > #ifdef HAVE_ALLOCA_H > left = alloca(maxLeftCol + 1); > #define CLEAN_RETURN return > #else > left = malloc(maxLeftCol + 1); > #define CLEAN_RETURN free( left ); return > #endif 97c87 < if (!*left) return ; --- > if (!*left) CLEAN_RETURN ; 107c97 < return; --- > CLEAN_RETURN; 125a116,117 > > CLEAN_RETURN; Index: poptparse.c =================================================================== RCS file: /cvs/pkgconfig/pkgconfig/poptparse.c,v retrieving revision 1.2 diff -r1.2 poptparse.c 1,24c1,3 < /* < Copyright (c) 1998 Red Hat Software < < Permission is hereby granted, free of charge, to any person obtaining a copy < of this software and associated documentation files (the "Software"), to deal < in the Software without restriction, including without limitation the rights < to use, copy, modify, merge, publish, distribute, sublicense, and/or sell < copies of the Software, and to permit persons to whom the Software is < furnished to do so, subject to the following conditions: < < The above copyright notice and this permission notice shall be included in < all copies or substantial portions of the Software. < < THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR < IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, < FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE < X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN < AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN < CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. < < Except as contained in this notice, the name of the X Consortium shall not be < used in advertising or otherwise to promote the sale, use or other dealings < in this Software without prior written authorization from the X Consortium. < */ --- > /* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING > file accompanying popt source distributions, available from > ftp://ftp.redhat.com/pub/code/popt */ 31c10,14 < # include --- > # ifdef _MSC_VER > # include > # else > # include > # endif 44,45c27,37 < int poptParseArgvString(char * s, int * argcPtr, char *** argvPtr) { < char * buf = strcpy(alloca(strlen(s) + 1), s); --- > int poptParseArgvString(char * s, int * argcPtr, char *** argvPtr) > { > int s_len = strlen(s); > #ifdef HAVE_ALLOCA_H > char * buf = strcpy(alloca(s_len + 1), s); > #define RETURN_CLEANUP( r_val ) return r_val > #else > char * buf; > char * free_ptr = buf = strdup( s ); > #define RETURN_CLEANUP( r_val ) free( free_ptr ); return r_val > #endif 59c51 < memset(buf, '\0', strlen(s) + 1); --- > memset(buf, '\0', s_len + 1); 66c58 < src++; --- > ++src; 69c61 < return POPT_ERROR_BADQUOTE; --- > RETURN_CLEANUP( POPT_ERROR_BADQUOTE ); 71c63,64 < if (*src != quote) *buf++ = '\\'; --- > if (*src != quote) > *buf++ = '\\'; 92c85 < return POPT_ERROR_BADQUOTE; --- > RETURN_CLEANUP( POPT_ERROR_BADQUOTE ); 121c114,115 < return 0; --- > > RETURN_CLEANUP( 0 );