extract strings from scripting module
[LibreOffice.git] / epm / epm-3.7.patch
blob02835bc3e5ce37645bb7cee2ebede3e688553240
1 diff -urN epm-3.7-old//bsd.c epm-3.7/bsd.c
2 --- misc/epm-3.7/bsd.c 2003-01-14 17:05:01.000000000 +0000
3 +++ misc/build/epm-3.7/bsd.c 2010-04-19 22:52:32.000000000 +0000
4 @@ -26,6 +26,13 @@
6 #include "epm.h"
8 +void cr2semicolon(char *command)
9 +{
10 + int len, i;
11 + len=strlen(command);
12 + for (i=0;i<len;i++)
13 + if(*(command+i)=='\n') *(command+i)=';';
17 * 'make_bsd()' - Make a FreeBSD software distribution package.
18 @@ -149,8 +156,17 @@
20 for (i = dist->num_depends, d = dist->depends; i > 0; i --, d ++)
22 +#ifdef __FreeBSD__
23 + if (d->type == DEPEND_REQUIRES) {
24 + if (dist->relnumber)
25 + fprintf(fp, "@pkgdep %s-%s-%d-%s", d->product, dist->version, dist->relnumber, platname);
26 + else
27 + fprintf(fp, "@pkgdep %s-%s-%s", d->product, dist->version, platname);
28 + }
29 +#else
30 if (d->type == DEPEND_REQUIRES)
31 fprintf(fp, "@pkgdep %s", d->product);
32 +#endif
33 else
34 #ifdef __FreeBSD__
36 @@ -179,9 +195,11 @@
37 " by the BSD packager.\n", stderr);
38 break;
39 case COMMAND_POST_INSTALL :
40 + cr2semicolon(c->command);
41 fprintf(fp, "@exec %s\n", c->command);
42 break;
43 case COMMAND_PRE_REMOVE :
44 + cr2semicolon(c->command);
45 fprintf(fp, "@unexec %s\n", c->command);
46 break;
47 case COMMAND_POST_REMOVE :
48 @@ -199,7 +217,7 @@
51 fprintf(fp, "@exec /bin/mkdir -p %s\n", file->dst);
52 - fprintf(fp, "@exec /bin/chown %s:%s %s\n", file->user, file->group,
53 + fprintf(fp, "@exec /usr/sbin/chown %s:%s %s\n", file->user, file->group,
54 file->dst);
55 fprintf(fp, "@exec /bin/chmod %04o %s\n", file->mode, file->dst);
57 @@ -326,12 +344,13 @@
58 if (Verbosity)
59 puts("Building FreeBSD pkg binary distribution...");
61 - if (run_command(NULL, "pkg_create -p / -s %s -c %s -d %s -f %s %s",
62 + if (run_command(NULL, "/usr/sbin/pkg_create -p / -s %s -c %s -d %s -f %s %s",
63 current, commentname, descrname, plistname, name))
64 return (1);
66 - if (run_command(NULL, "mv %s.tgz %s", name, directory))
67 - return (1);
68 + if (run_command(NULL, "mv %s.tbz %s", name, directory))
69 + if (run_command(NULL, "mv %s.tgz %s", name, directory))
70 + return (1);
73 * Remove temporary files...
74 diff -urN epm-3.7-old//configure epm-3.7/configure
75 --- misc/epm-3.7/configure 2003-07-24 01:20:54.000000000 +0000
76 +++ misc/build/epm-3.7/configure 2010-04-19 22:52:32.000000000 +0000
77 @@ -1238,6 +1238,11 @@
79 fi;
81 +# Check whether --enable-fltk or --disable-fltk was given.
82 +if test "${enable_fltk+set}" = set; then
83 + enableval="$enable_fltk"
84 +fi;
87 # Check whether --with-docdir or --without-docdir was given.
88 if test "${with_docdir+set}" = set; then
89 @@ -4904,36 +4909,38 @@
93 -# Extract the first word of "fltk-config", so it can be a program name with args.
94 -set dummy fltk-config; ac_word=$2
95 -echo "$as_me:$LINENO: checking for $ac_word" >&5
96 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
97 -if test "${ac_cv_path_FLTKCONFIG+set}" = set; then
98 - echo $ECHO_N "(cached) $ECHO_C" >&6
99 -else
100 - case $FLTKCONFIG in
101 - [\\/]* | ?:[\\/]*)
102 - ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path.
103 - ;;
104 - *)
105 - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
106 -for as_dir in $PATH
108 - IFS=$as_save_IFS
109 - test -z "$as_dir" && as_dir=.
110 - for ac_exec_ext in '' $ac_executable_extensions; do
111 - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
112 - ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext"
113 - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
114 - break 2
115 +if eval "test x$enable_fltk = xyes"; then
116 + # Extract the first word of "fltk-config", so it can be a program name with args.
117 + set dummy fltk-config; ac_word=$2
118 + echo "$as_me:$LINENO: checking for $ac_word" >&5
119 + echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
120 + if test "${ac_cv_path_FLTKCONFIG+set}" = set; then
121 + echo $ECHO_N "(cached) $ECHO_C" >&6
122 + else
123 + case $FLTKCONFIG in
124 + [\\/]* | ?:[\\/]*)
125 + ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path.
126 + ;;
127 + *)
128 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
129 + for as_dir in $PATH
130 + do
131 + IFS=$as_save_IFS
132 + test -z "$as_dir" && as_dir=.
133 + for ac_exec_ext in '' $ac_executable_extensions; do
134 + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
135 + ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext"
136 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
137 + break 2
138 + fi
139 + done
140 + done
142 + ;;
143 + esac
145 -done
146 -done
148 - ;;
149 -esac
150 + FLTKCONFIG=$ac_cv_path_FLTKCONFIG
152 -FLTKCONFIG=$ac_cv_path_FLTKCONFIG
154 if test -n "$FLTKCONFIG"; then
155 echo "$as_me:$LINENO: result: $FLTKCONFIG" >&5
156 @@ -4950,8 +4957,10 @@
157 INSTALL_GUIS=""
158 INSTALL_OSX=""
160 +if eval "test x$enable_fltk = xyes"; then
161 { echo "$as_me:$LINENO: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&5
162 echo "$as_me: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&2;}
164 else
165 CXXFLAGS="`$FLTKCONFIG --cflags` ${CXXFLAGS}"
166 GUIS="setup uninst"
167 diff -urN epm-3.7-old//deb.c epm-3.7/deb.c
168 --- misc/epm-3.7/deb.c 2003-01-15 14:29:24.000000000 +0000
169 +++ misc/build/epm-3.7/deb.c 2010-04-19 22:53:34.000000000 +0000
170 @@ -26,6 +26,28 @@
172 #include "epm.h"
175 + * 'add_size()' - Append Installed-Size tag to DEBIAN/control file
176 + */
178 +int /* O - 0 = success, 1 = fail */
179 +add_size(FILE *fpControl, /* Control file stream */
180 + const char *directory) /* Directory containing all files to package */
182 + FILE *fp;
183 + char command[1024];
185 + snprintf(command, sizeof(command), "du -k -s %s", directory);
186 + fp = popen(command, "r");
187 + if( NULL != fp )
189 + char size[1024];
190 + fscanf(fp, "%s .", size);
191 + fprintf(fpControl, "Installed-Size: %s\n", size);
192 + return pclose(fp);
194 + return 1;
198 * 'make_deb()' - Make a Debian software distribution package.
199 @@ -61,18 +83,37 @@
200 if (Verbosity)
201 puts("Creating Debian distribution...");
203 + /*
204 + * Use debian default naming scheme
205 + */
207 + if (!strcmp(platform->machine, "intel"))
208 +#ifdef __FreeBSD_kernel__
209 + platname = "kfreebsd-i386";
210 +#else
211 + platname = "i386";
212 +#endif
213 + else if (!strcmp(platform->machine, "x86_64"))
214 +#ifdef __FreeBSD_kernel__
215 + platname = "kfreebsd-amd64";
216 +#else
217 + platname = "amd64";
218 +#endif
219 + else if (!strcmp(platform->machine, "ppc"))
220 + platname = "powerpc";
222 if (dist->relnumber)
224 if (platname[0])
225 - snprintf(name, sizeof(name), "%s-%s-%d-%s", prodname, dist->version, dist->relnumber,
226 + snprintf(name, sizeof(name), "%s_%s-%d_%s", prodname, dist->version, dist->relnumber,
227 platname);
228 else
229 - snprintf(name, sizeof(name), "%s-%s-%d", prodname, dist->version, dist->relnumber);
230 + snprintf(name, sizeof(name), "%s_%s-%d", prodname, dist->version, dist->relnumber);
232 else if (platname[0])
233 - snprintf(name, sizeof(name), "%s-%s-%s", prodname, dist->version, platname);
234 + snprintf(name, sizeof(name), "%s_%s_%s", prodname, dist->version, platname);
235 else
236 - snprintf(name, sizeof(name), "%s-%s", prodname, dist->version);
237 + snprintf(name, sizeof(name), "%s_%s", prodname, dist->version);
240 * Write the control file for DPKG...
241 @@ -108,8 +141,20 @@
242 * (which we change in get_platform to a common name)
245 - if (strcmp(platform->machine, "intel") == 0)
246 + if (!strcmp(platform->machine, "intel"))
247 +#ifdef __FreeBSD_kernel__
248 + fputs("Architecture: kfreebsd-i386\n", fp);
249 +#else
250 fputs("Architecture: i386\n", fp);
251 +#endif
252 + else if (!strcmp(platform->machine, "x86_64"))
253 +#ifdef __FreeBSD_kernel__
254 + fputs("Architecture: kfreebsd-amd64\n", fp);
255 +#else
256 + fputs("Architecture: amd64\n", fp);
257 +#endif
258 + else if (!strcmp(platform->machine, "ppc"))
259 + fputs("Architecture: powerpc\n", fp);
260 else
261 fprintf(fp, "Architecture: %s\n", platform->machine);
263 @@ -148,9 +193,9 @@
264 putc('\n', fp);
269 fclose(fp);
273 * Write the preinst file for DPKG...
275 @@ -417,6 +462,27 @@
280 + /*
281 + * Calculate and append Installed-Size to DEBIAN/control
282 + */
284 + if (Verbosity)
285 + puts("Calculating Installed-Size...");
287 + snprintf(filename, sizeof(filename), "%s/%s/DEBIAN/control", directory, name);
288 + if ((fp = fopen(filename, "a")) == NULL)
290 + fprintf(stderr, "epm: Unable to Installed-Size to file \"%s\" - %s\n", filename,
291 + strerror(errno));
292 + return (1);
295 + snprintf(filename, sizeof(filename), "%s/%s", directory, name);
296 + add_size(fp, filename);
297 + fclose(fp);
301 * Build the distribution from the spec file...
303 diff -urN epm-3.7-old//dist.c epm-3.7/dist.c
304 --- misc/epm-3.7/dist.c 2003-08-07 14:14:40.000000000 +0000
305 +++ misc/build/epm-3.7/dist.c 2010-04-19 22:52:32.000000000 +0000
306 @@ -394,8 +394,13 @@
307 strcpy(platform->machine, "mips");
308 #elif defined(__hpux)
309 strcpy(platform->machine, "hppa");
310 -#elif defined(_AIX) || defined(__APPLE__)
311 +#elif defined(_AIX)
312 strcpy(platform->machine, "powerpc");
313 +#elif defined(__APPLE__)
314 + if (strstr(platform->machine, "86") != NULL)
315 + strcpy(platform->machine, "intel");
316 + else
317 + strcpy(platform->machine, "powerpc");
318 #else
319 for (temp = platform->machine; *temp != '\0'; temp ++)
320 if (*temp == '-' || *temp == '_')
321 @@ -407,7 +412,12 @@
322 *temp = tolower(*temp);
324 if (strstr(platform->machine, "86") != NULL)
325 - strcpy(platform->machine, "intel");
327 + if (strstr(platform->machine, "64") != NULL)
328 + strcpy(platform->machine, "x86_64");
329 + else
330 + strcpy(platform->machine, "intel");
332 else if (strncmp(platform->machine, "sun", 3) == 0)
333 strcpy(platform->machine, "sparc");
334 #endif /* __sgi */
335 diff -urN epm-3.7-old//epm.c epm-3.7/epm.c
336 --- misc/epm-3.7/epm.c 2003-10-28 14:48:30.000000000 +0000
337 +++ misc/build/epm-3.7/epm.c 2010-04-19 22:52:32.000000000 +0000
338 @@ -547,6 +547,7 @@
340 puts(EPM_VERSION);
341 puts("Copyright 1999-2003 by Easy Software Products.");
342 + puts("Patched for OpenOffice.org");
343 puts("");
344 puts("EPM is free software and comes with ABSOLUTELY NO WARRANTY; for details");
345 puts("see the GNU General Public License in the file COPYING or at");
346 diff -urN epm-3.7-old//file.c epm-3.7/file.c
347 --- misc/epm-3.7/file.c 2003-07-23 21:41:08.000000000 +0000
348 +++ misc/build/epm-3.7/file.c 2010-04-19 22:52:32.000000000 +0000
349 @@ -108,7 +108,6 @@
350 fclose(dstfile);
352 chmod(dst, mode);
353 - chown(dst, owner, group);
355 return (0);
357 @@ -138,7 +137,6 @@
359 mkdir(buffer, 0777);
360 chmod(buffer, mode | 0700);
361 - chown(buffer, owner, group);
365 @@ -151,7 +149,6 @@
367 mkdir(buffer, 0777);
368 chmod(buffer, mode | 0700);
369 - chown(buffer, owner, group);
372 return (0);
373 diff -urN epm-3.7-old//osx.c epm-3.7/osx.c
374 --- misc/epm-3.7/osx.c 2003-07-23 21:41:08.000000000 +0000
375 +++ misc/build/epm-3.7/osx.c 2010-04-19 22:52:32.000000000 +0000
376 @@ -373,7 +373,7 @@
377 else
378 snprintf(filename, sizeof(filename), "%s/%s", current, directory);
380 - run_command(NULL, "/Developer/Applications/PackageMaker.app/"
381 + run_command(NULL, "/Developer/Applications/Utilities/PackageMaker.app/"
382 "Contents/MacOS/PackageMaker -build "
383 "-p %s/%s.pkg -f %s/Package -r %s/Resources -d %s/%s-desc.plist -i %s/%s-info.plist",
384 filename, prodname, filename, filename, filename, prodname, filename, prodname);
385 diff -urN epm-3.7-old//pkg.c epm-3.7/pkg.c
386 --- misc/epm-3.7/pkg.c 2002-12-17 18:57:56.000000000 +0000
387 +++ misc/build/epm-3.7/pkg.c 2010-04-19 22:52:32.000000000 +0000
388 @@ -429,75 +429,6 @@
390 fclose(fp);
392 - /*
393 - * Build the distribution from the prototype file...
394 - */
396 - if (Verbosity)
397 - puts("Building PKG binary distribution...");
399 - if (run_command(NULL, "pkgmk -o -f %s/%s.prototype -d %s/%s",
400 - directory, prodname, current, directory))
401 - return (1);
403 - /*
404 - * Tar and compress the distribution...
405 - */
407 - if (Verbosity)
408 - puts("Creating tar.gz file for distribution...");
410 - snprintf(filename, sizeof(filename), "%s/%s.tar.gz", directory, name);
412 - if ((tarfile = tar_open(filename, 1)) == NULL)
413 - return (1);
415 - snprintf(filename, sizeof(filename), "%s/%s", directory, prodname);
417 - if (tar_directory(tarfile, filename, prodname))
419 - tar_close(tarfile);
420 - return (1);
423 - tar_close(tarfile);
425 - /*
426 - * Make a package stream file...
427 - */
429 - if (Verbosity)
430 - puts("Copying into package stream file...");
432 - if (run_command(directory, "pkgtrans -s %s/%s %s.pkg %s",
433 - current, directory, name, prodname))
434 - return (1);
436 - /*
437 - * Remove temporary files...
438 - */
440 - if (!KeepFiles)
442 - if (Verbosity)
443 - puts("Removing temporary distribution files...");
445 - snprintf(filename, sizeof(filename), "%s/%s.pkginfo", directory, prodname);
446 - unlink(filename);
447 - snprintf(filename, sizeof(filename), "%s/%s.depend", directory, prodname);
448 - unlink(filename);
449 - snprintf(filename, sizeof(filename), "%s/%s.prototype", directory, prodname);
450 - unlink(filename);
451 - if (preinstall[0])
452 - unlink(preinstall);
453 - if (postinstall[0])
454 - unlink(postinstall);
455 - if (preremove[0])
456 - unlink(preremove);
457 - if (postremove[0])
458 - unlink(postremove);
461 return (0);
464 diff -urN epm-3.7-old//qprintf.c epm-3.7/qprintf.c
465 --- misc/epm-3.7-old/qprintf.c 2003-01-27 21:48:03.000000000 +0000
466 +++ misc/build/epm-3.7/qprintf.c 2010-04-19 22:52:32.000000000 +0000
467 @@ -181,12 +181,19 @@
469 for (i = slen; i > 0; i --, s ++, bytes ++)
471 +#if defined(__FreeBSD__)
472 + if (strchr("`~!#%^&*()[{]}\\|;\'\"<>? ", *s))
474 + putc('\\', fp);
475 + bytes ++;
477 +#else
478 if (strchr("`~!#$%^&*()[{]}\\|;\'\"<>? ", *s))
480 putc('\\', fp);
481 bytes ++;
484 +#endif
485 putc(*s, fp);
488 diff -urN epm-3.7-old//rpm.c epm-3.7/rpm.c
489 --- misc/epm-3.7/rpm.c 2003-10-01 19:27:15.000000000 +0000
490 +++ misc/build/epm-3.7/rpm.c 2010-04-19 22:52:32.000000000 +0000
491 @@ -38,7 +38,7 @@
492 dist_t *dist, /* I - Distribution information */
493 struct utsname *platform) /* I - Platform information */
495 - int i; /* Looping var */
496 + int i,n; /* Looping vars */
497 FILE *fp; /* Spec file */
498 char name[1024]; /* Full product name */
499 char specname[1024]; /* Spec filename */
500 @@ -160,6 +160,8 @@
501 fprintf(fp, "Requires: %s", dname);
502 else if (d->type == DEPEND_PROVIDES)
503 fprintf(fp, "Provides: %s", dname);
504 + else if (d->type == DEPEND_REPLACES)
505 + fprintf(fp, "Obsoletes: %s", dname);
506 else
507 fprintf(fp, "Conflicts: %s", dname);
509 @@ -186,15 +188,33 @@
510 for (i = 0; i < dist->num_descriptions; i ++)
511 fprintf(fp, "%s\n", dist->descriptions[i]);
513 - fputs("%pre\n", fp);
514 + /*
515 + * %pre
516 + */
517 + n = 0;
518 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
520 if (c->type == COMMAND_PRE_INSTALL)
522 + if (1 == ++n) /* Only write %pre if there is at least one command */
523 + fputs("%pre\n", fp);
524 fprintf(fp, "%s\n", c->command);
528 - fputs("%post\n", fp);
529 + /*
530 + * %post
531 + */
532 + n = 0;
533 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
535 if (c->type == COMMAND_POST_INSTALL)
537 + if (1 == ++n) /* Only write %post if there is at least one command */
538 + fputs("%post\n", fp);
539 fprintf(fp, "%s\n", c->command);
543 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
544 if (tolower(file->type) == 'i')
545 @@ -202,6 +222,8 @@
547 if (i)
549 + if (1 == ++n) /* If not previously done so, write %post here */
550 + fputs("%post\n", fp);
551 fputs("if test \"x$1\" = x1; then\n", fp);
552 fputs(" echo Setting up init scripts...\n", fp);
554 @@ -259,13 +281,17 @@
555 fputs("fi\n", fp);
558 - fputs("%preun\n", fp);
559 + /*
560 + * %preun
561 + */
562 + n = 0;
563 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
564 if (tolower(file->type) == 'i')
565 break;
567 if (i)
569 + fputs("%preun\n", fp); ++n; /* Need to write %preun here */
570 fputs("if test \"x$1\" = x0; then\n", fp);
571 fputs(" echo Cleaning up init scripts...\n", fp);
573 @@ -315,13 +341,29 @@
576 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
578 if (c->type == COMMAND_PRE_REMOVE)
580 + if (1 == ++n) /* Only write %preun if not previously done so */
581 + fputs("%preun\n", fp);
583 fprintf(fp, "%s\n", c->command);
587 - fputs("%postun\n", fp);
588 + /*
589 + * %post
590 + */
591 + n = 0;
592 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
594 if (c->type == COMMAND_POST_REMOVE)
596 + if (1 == ++n) /* Only write %post if there is at least one command */
597 + fputs("%postun\n", fp);
598 fprintf(fp, "%s\n", c->command);
602 fputs("%files\n", fp);
603 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
604 @@ -415,53 +457,6 @@
608 - /*
609 - * Build the distribution from the spec file...
610 - */
612 - if (Verbosity)
613 - puts("Building RPM binary distribution...");
615 - if (strcmp(platform->machine, "intel") == 0)
617 - if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "i386 %s",
618 - Verbosity == 0 ? "--quiet" : "", specname))
619 - return (1);
621 - else if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "%s %s",
622 - Verbosity == 0 ? "--quiet" : "", platform->machine,
623 - specname))
624 - return (1);
626 - /*
627 - * Move the RPM to the local directory and rename the RPM using the
628 - * product name specified by the user...
629 - */
631 - if (strcmp(platform->machine, "intel") == 0)
632 - run_command(NULL, "/bin/mv %s/RPMS/i386/%s-%s-%d.i386.rpm %s/%s.rpm",
633 - rpmdir, prodname, dist->version, dist->relnumber,
634 - directory, name);
635 - else
636 - run_command(NULL, "/bin/mv %s/RPMS/%s/%s-%s-%d.%s.rpm %s/%s.rpm",
637 - rpmdir, platform->machine, prodname, dist->version,
638 - dist->relnumber, platform->machine, directory, name);
640 - /*
641 - * Remove temporary files...
642 - */
644 - if (!KeepFiles)
646 - if (Verbosity)
647 - puts("Removing temporary distribution files...");
649 - run_command(NULL, "/bin/rm -rf %s/RPMS", directory);
650 - run_command(NULL, "/bin/rm -rf %s/buildroot", directory);
652 - unlink(specname);
655 return (0);