diff options
author | ewt <devnull@localhost> | 1998-03-04 16:51:06 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1998-03-04 16:51:06 +0000 |
commit | d29004dc6918935f3a6916e59f373874a5f6ab85 (patch) | |
tree | d5faec19f0fc89fc5c33871f000516e2524b88d4 | |
parent | 25231c427210c21570097a10f4782850a02246ff (diff) | |
download | librpm-tizen-d29004dc6918935f3a6916e59f373874a5f6ab85.tar.gz librpm-tizen-d29004dc6918935f3a6916e59f373874a5f6ab85.tar.bz2 librpm-tizen-d29004dc6918935f3a6916e59f373874a5f6ab85.zip |
1) include cleanups for portability
2) pulled popt structures and variables out of functions -- they need to
be global due to stupid compilers
3) modified the Makefile to use relative dependencies, and make dependencies
optional
CVS patchset: 2020
CVS date: 1998/03/04 16:51:06
-rw-r--r-- | build/Makefile.in | 11 | ||||
-rw-r--r-- | build/build.c | 6 | ||||
-rw-r--r-- | build/files.c | 11 | ||||
-rw-r--r-- | build/misc.c | 10 | ||||
-rw-r--r-- | build/pack.c | 1 | ||||
-rw-r--r-- | build/package.c | 2 | ||||
-rw-r--r-- | build/parseChangelog.c | 6 | ||||
-rw-r--r-- | build/parseDescription.c | 22 | ||||
-rw-r--r-- | build/parseFiles.c | 20 | ||||
-rw-r--r-- | build/parsePreamble.c | 2 | ||||
-rw-r--r-- | build/parsePrep.c | 38 | ||||
-rw-r--r-- | build/parseScript.c | 24 | ||||
-rw-r--r-- | build/parseSpec.c | 2 | ||||
-rw-r--r-- | build/reqprov.c | 3 |
14 files changed, 101 insertions, 57 deletions
diff --git a/build/Makefile.in b/build/Makefile.in index 0ceccb3d5..d92f686d8 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -1,4 +1,5 @@ srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = $(srcdir) LIBOBJECTS = \ @@ -16,11 +17,7 @@ LOADLIBES = -lrpm -lz ../popt/libpopt.a $(LIBEFENCE) include ../Makefile.inc -ifeq (.depend,$(wildcard .depend)) TARGET=everything -else -TARGET=depend everything -endif all: $(TARGET) @@ -40,10 +37,12 @@ clean: rm -f *.a *.o *~ $(PROGS) distclean: clean - rm -f .depend Makefile + rm -f Makefile depend: - $(CPP) $(CFLAGS) -M $(srcdir)/*.c > .depend + topdir_path=`( cd $(top_srcdir) && pwd )` ; \ + $(CPP) $(CFLAGS) -MM $(srcdir)/*.c | \ + sed s+$$topdir_path+$(top_srcdir)+g > .depend ifeq (.depend,$(wildcard .depend)) include .depend diff --git a/build/build.c b/build/build.c index d47e05e69..9a8c7055f 100644 --- a/build/build.c +++ b/build/build.c @@ -1,3 +1,9 @@ +#include "config.h" + +#ifdef HAVE_ALLOCA_A +#include <alloca.h> +#endif + #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> diff --git a/build/files.c b/build/files.c index 7ef3a5402..a768db1c4 100644 --- a/build/files.c +++ b/build/files.c @@ -1,8 +1,13 @@ +#include "config.h" +#ifdef HAVE_GLOB_H +# include <glob.h> +#else +# include "misc-glob.h" +#endif + #include <string.h> #include <malloc.h> #include <stdlib.h> -#include <glob.h> -#include <time.h> #include "spec.h" #include "package.h" @@ -919,7 +924,7 @@ static int parseForSimple(Spec spec, Package pkg, char *buf, appendLineStringBuf(pkg->specialDoc, buf); appendLineStringBuf(pkg->specialDoc, "export DOCDIR"); appendLineStringBuf(pkg->specialDoc, "rm -rf $DOCDIR"); - appendLineStringBuf(pkg->specialDoc, "mkdir -p $DOCDIR"); + appendLineStringBuf(pkg->specialDoc, MKDIR_P " $DOCDIR"); *fileName = buf; fl->passedSpecialDoc = 1; diff --git a/build/misc.c b/build/misc.c index 72c7ddeb1..4b74ec64d 100644 --- a/build/misc.c +++ b/build/misc.c @@ -1,12 +1,16 @@ -#include <string.h> +#include "config.h" + +#if HAVE_STRING_H +# include <string.h> +#endif + #include <stdlib.h> #include <ctype.h> #include <signal.h> -#include <unistd.h> #include <fcntl.h> -#include <sys/types.h> #include <sys/wait.h> #include <errno.h> +#include <sys/types.h> #include "misc.h" #include "spec.h" diff --git a/build/pack.c b/build/pack.c index 122e01435..d984c77f9 100644 --- a/build/pack.c +++ b/build/pack.c @@ -7,6 +7,7 @@ #include <errno.h> #include <signal.h> #include <time.h> +#include <stdlib.h> #include "spec.h" #include "header.h" diff --git a/build/package.c b/build/package.c index 9184282a1..83c46c6c3 100644 --- a/build/package.c +++ b/build/package.c @@ -4,7 +4,7 @@ #include "rpmlib.h" #include "files.h" -#include <malloc.h> +#include <stdlib.h> int lookupPackage(Spec spec, char *name, int flag, Package *pkg) { diff --git a/build/parseChangelog.c b/build/parseChangelog.c index 1e04a7b4b..743379079 100644 --- a/build/parseChangelog.c +++ b/build/parseChangelog.c @@ -1,8 +1,14 @@ +#include "config.h" + #include <stdlib.h> #include <time.h> #include <string.h> #include <sys/types.h> +#ifdef HAVE_ALLOCA_H +# include <alloca.h> +#endif + #include "read.h" #include "part.h" diff --git a/build/parseDescription.c b/build/parseDescription.c index 01af29edc..4888875ac 100644 --- a/build/parseDescription.c +++ b/build/parseDescription.c @@ -1,4 +1,4 @@ -#include <malloc.h> +#include <stdlib.h> #include "spec.h" #include "header.h" @@ -9,22 +9,28 @@ #include "package.h" #include "popt/popt.h" +/* These have to be global scope to make up for *stupid* compilers */ + static char *name; + static char *lang; + + static struct poptOption optionsTable[] = { + { NULL, 'n', POPT_ARG_STRING, &name, 'n' }, + { NULL, 'l', POPT_ARG_STRING, &lang, 'l' }, + { 0, 0, 0, 0, 0 } + }; + int parseDescription(Spec spec) { int nextPart; StringBuf sb; - char *name = NULL; - char *lang = RPMBUILD_DEFAULT_LANG; int flag = PART_SUBNAME; Package pkg; int rc, argc; char arg, **argv = NULL; poptContext optCon = NULL; - struct poptOption optionsTable[] = { - { NULL, 'n', POPT_ARG_STRING, &name, 'n' }, - { NULL, 'l', POPT_ARG_STRING, &lang, 'l' }, - { 0, 0, 0, 0, 0 } - }; + + name = NULL; + lang = RPMBUILD_DEFAULT_LANG; if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { rpmError(RPMERR_BADSPEC, "line %d: Error parsing %%description: %s", diff --git a/build/parseFiles.c b/build/parseFiles.c index 91eac5755..5947bacf2 100644 --- a/build/parseFiles.c +++ b/build/parseFiles.c @@ -1,5 +1,5 @@ +#include <stdlib.h> #include <string.h> -#include <malloc.h> #include "header.h" #include "read.h" @@ -10,21 +10,25 @@ #include "stringbuf.h" #include "popt/popt.h" +/* These have to be global scope to make up for *stupid* compilers */ + static char *name; + static char *file; + static struct poptOption optionsTable[] = { + { NULL, 'n', POPT_ARG_STRING, &name, 'n' }, + { NULL, 'f', POPT_ARG_STRING, &file, 'f' }, + { 0, 0, 0, 0, 0 } + }; + int parseFiles(Spec spec) { int nextPart; Package pkg; - char *name = NULL; - char *file = NULL; int rc, argc; char arg, **argv = NULL; int flag = PART_SUBNAME; poptContext optCon = NULL; - struct poptOption optionsTable[] = { - { NULL, 'n', POPT_ARG_STRING, &name, 'n' }, - { NULL, 'f', POPT_ARG_STRING, &file, 'f' }, - { 0, 0, 0, 0, 0 } - }; + + name = file = NULL; if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { rpmError(RPMERR_BADSPEC, "line %d: Error parsing %%files: %s", diff --git a/build/parsePreamble.c b/build/parsePreamble.c index e88d530f1..fc8eab03f 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -1,5 +1,5 @@ +#include <stdlib.h> #include <string.h> -#include <malloc.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> diff --git a/build/parsePrep.c b/build/parsePrep.c index 12a403d14..ba9a26aba 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -2,7 +2,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <string.h> -#include <malloc.h> +#include <stdlib.h> #include <errno.h> #include "spec.h" @@ -15,6 +15,21 @@ #include "misc.h" #include "config.h" +/* These have to be global to make up for stupid compilers */ + static int leaveDirs, skipDefaultAction; + static int createDir, quietly; + static char * dirName; + static struct poptOption optionsTable[] = { + { NULL, 'a', POPT_ARG_STRING, NULL, 'a' }, + { NULL, 'b', POPT_ARG_STRING, NULL, 'b' }, + { NULL, 'c', 0, &createDir, 0 }, + { NULL, 'D', 0, &leaveDirs, 0 }, + { NULL, 'n', POPT_ARG_STRING, &dirName, 0 }, + { NULL, 'T', 0, &skipDefaultAction, 0 }, + { NULL, 'q', 0, &quietly, 0 }, + { 0, 0, 0, 0, 0 } + }; + static int doSetupMacro(Spec spec, char *line); static int doPatchMacro(Spec spec, char *line); static char *doPatch(Spec spec, int c, int strip, char *db, @@ -82,9 +97,6 @@ int parsePrep(Spec spec) static int doSetupMacro(Spec spec, char *line) { char *version, *name; - int leaveDirs = 0, skipDefaultAction = 0; - int createDir = 0, quietly = 0; - char * dirName = NULL; char buf[BUFSIZ]; StringBuf before; StringBuf after; @@ -96,16 +108,10 @@ static int doSetupMacro(Spec spec, char *line) char * chptr; int rc; int num; - struct poptOption optionsTable[] = { - { NULL, 'a', POPT_ARG_STRING, NULL, 'a' }, - { NULL, 'b', POPT_ARG_STRING, NULL, 'b' }, - { NULL, 'c', 0, &createDir, 0 }, - { NULL, 'D', 0, &leaveDirs, 0 }, - { NULL, 'n', POPT_ARG_STRING, &dirName, 0 }, - { NULL, 'T', 0, &skipDefaultAction, 0 }, - { NULL, 'q', 0, &quietly, 0 }, - { 0, 0, 0, 0, 0 } - }; + + leaveDirs = skipDefaultAction = 0; + createDir = quietly = 0; + dirName = NULL; if ((rc = poptParseArgvString(line, &argc, &argv))) { rpmError(RPMERR_BADSPEC, "Error parsing %%setup: %s", @@ -181,7 +187,7 @@ static int doSetupMacro(Spec spec, char *line) /* if necessary, create and cd into the proper dir */ if (createDir) { - sprintf(buf, "mkdir -p %s\ncd %s", + sprintf(buf, MKDIR_P " %s\ncd %s", spec->buildSubdir, spec->buildSubdir); appendLineStringBuf(spec->prep, buf); } @@ -217,7 +223,7 @@ static int doSetupMacro(Spec spec, char *line) /* clean up permissions etc */ if (!geteuid()) { appendLineStringBuf(spec->prep, "chown -R root ."); - appendLineStringBuf(spec->prep, "chgrp -R root ."); + appendLineStringBuf(spec->prep, "chgrp -R " ROOT_GROUP " ."); } if (rpmGetVar(RPMVAR_FIXPERMS)) { diff --git a/build/parseScript.c b/build/parseScript.c index 55ba1dcf0..cb77e866a 100644 --- a/build/parseScript.c +++ b/build/parseScript.c @@ -13,6 +13,17 @@ /* Define this to be 1 to turn on -p "<prog> <args>..." ability */ #define USE_PROG_STRING_ARRAY 0 +/* these have to be globab because of stupid compilers */ + static char *name; + static char *prog; + static char *file; + static struct poptOption optionsTable[] = { + { NULL, 'p', POPT_ARG_STRING, &prog, 'p' }, + { NULL, 'n', POPT_ARG_STRING, &name, 'n' }, + { NULL, 'f', POPT_ARG_STRING, &file, 'f' }, + { 0, 0, 0, 0, 0 } + }; + int parseScript(Spec spec, int parsePart) { /* There are a few options to scripts: */ @@ -23,9 +34,6 @@ int parseScript(Spec spec, int parsePart) /* -f <file> */ char *p; - char *name = NULL; - char *prog = "/bin/sh"; - char *file = NULL; char **progArgv = NULL; int progArgc; char *partname = NULL; @@ -35,16 +43,14 @@ int parseScript(Spec spec, int parsePart) Package pkg; StringBuf sb; int nextPart; + + char *name = NULL; + char *prog = "/bin/sh"; + char *file = NULL; int rc, argc; char arg, **argv = NULL; poptContext optCon = NULL; - struct poptOption optionsTable[] = { - { NULL, 'p', POPT_ARG_STRING, &prog, 'p' }, - { NULL, 'n', POPT_ARG_STRING, &name, 'n' }, - { NULL, 'f', POPT_ARG_STRING, &file, 'f' }, - { 0, 0, 0, 0, 0 } - }; switch (parsePart) { case PART_PRE: diff --git a/build/parseSpec.c b/build/parseSpec.c index a3badbb18..36cc3ecf0 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -1,7 +1,7 @@ #include <ctype.h> #include <unistd.h> #include <string.h> -#include <malloc.h> +#include <stdlib.h> #include "header.h" #include "rpmlib.h" diff --git a/build/reqprov.c b/build/reqprov.c index 0a2abfb6f..9fee21111 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -1,6 +1,7 @@ /* reqprov.c -- require/provide handling */ -#include <malloc.h> +#include <stdlib.h> +#include <string.h> #include "spec.h" #include "reqprov.h" |