Home > tags> MSYS

MSYS

Part 2 compiled with MinGW the Jpegopitm

I might come together in one place where it is more fix following changes'm a change of Jpegoptim.c.

@@ -53,6 +53,39 @@ #define ICC_IDENT_STRING "ICC_PROFILE\0" #define ICC_IDENT_STRING_SIZE 12 +#ifdef WIN32 +#define uid_t int +#define gid_t int +#define ROOT_UID 0 +#define ROOT_GID 0 +#define realpath(N,R) _fullpath((R),(N),_MAX_PATH) +uid_t getuid(void) +{ + return ROOT_UID; +} +uid_t geteuid(void) +{ + return ROOT_UID; +} +gid_t getgid(void) +{ + return ROOT_GID; +} +gid_t getegid(void) +{ + return ROOT_GID; +} +int setuid(uid_t uid) +{ + return (uid == ROOT_UID ? 0 : -1); +} +int setgid(gid_t gid) +{ + return (gid == ROOT_GID ? 0 : -1); +} + +#endif + void fatal(const char *msg); struct my_error_mgr { 

Compiled with MinGW the Jpegopitm

I stumbled a little note to compile the Jpegoptim.

  1. Unzip the placement jpegoptim-1.2.3 under msys / src /
  2. Start msys, enter the following commands:
     $ cd /src/jpegoptim-1.2.3/ $ autoconf $ configure 
  3. configure does not pass, the following error come out
     configure: error: cannot find install-sh, install.sh, or shtool in aux "."/aux 
  4. to be modified as follows configure.in
     @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(jpegoptim.c) AC_CONFIG_HEADER(config.h) -AC_CONFIG_AUX_DIR(aux) +AC_CONFIG_AUX_DIR(sub) AC_CANONICAL_HOST 
  5. Create a sub folder, bring from the appropriate location such as install-sh (In the example from Jpeglib)
     $ mkdir sub $ cp ../jpeg-6bx/install-sh ../jpeg-6bx/config.sub ../jpeg-6bx/config.guess ./sub 
  6. Again, to generate a configure file, run the configure
     $ autoconf $ configure 
  7. If you configure through, you run the make. Then get the following errors:
     jpegoptim.c:354: undefined reference to 'realpath' jpegoptim.c:354: undefined reference to 'realpath' 
  8. to be modified as follows jpegoptim.c
     @@ -351,7 +351,11 @@ } break; case 'd': - if (realpath(optarg,dest_path)==NULL || !is_directory(dest_path)) { +#ifdef WIN32 + if (_fullpath(dest_path,optarg,MAXPATHLEN)==NULL || !is_directory(dest_path)) { +#else + if (realpath(optarg,dest_path)==NULL || !is_directory(dest_path)) { +#endif fatal("invalid argument for option -d, --dest"); } if (verbose_mode) @@ -441,8 +445,13 @@ fatal("splitdir() failed!"); strncpy(newname,argv[i],sizeof(newname)); } - snprintf(tmpfilename,sizeof(tmpfilename), +#ifdef WIN32 + snprintf(tmpfilename,sizeof(tmpfilename), + "%sjpegoptim-%d.tmp", tmpdir, (int)getpid()); +#else + snprintf(tmpfilename,sizeof(tmpfilename), "%sjpegoptim-%d-%d.tmp", tmpdir, (int)getuid(), (int)getpid()); +#endif } retry_point: 
  9. Again, the compilation is passed in the make.

it, although it is folder named aux auxiliary scripts such as install-sh is it a relic of the system each BSD,
You can not create a folder named aux special folder in the remnants of DOS in Windows.
Therefore, we store some kinds auxiliary script to change the "sub" references, you can create a "sub" new folder, which is included in the software system GNU.
In addition, getuid realpath and that was in error at compile time is a function of the POSIX system
Has been deleted or replaced with one that works the same or because Windows does not exist.
I had better rewrite it more beautiful in our example but replaced the realpath in order to pass the compilation _fullpath

Home > tags> MSYS

Search
Feed
Translation
Japanese flagItalian flagKorean flagChinese (Simplified) flagChinese (Traditional) flagEnglish flagGerman flagFrench flagRussian flagVietnamese flagThai flag

Back to the top of the page