Handle -idirafter specially

Don't split -idirafter from its argument.

Fixes Freedesktop #23480
This commit is contained in:
Tollef Fog Heen 2010-05-09 09:35:12 +02:00
parent fbc4f8e076
commit c5a3105f41
4 changed files with 38 additions and 9 deletions

View file

@ -1,10 +1,10 @@
TESTS = check-cflags check-libs check-define-variable \
check-libs-private check-requires-private check-includedir \
check-conflicts check-missing
check-conflicts check-missing check-idirafter
EXTRA_DIST = $(TESTS) common simple.pc requires-test.pc public-dep.pc \
private-dep.pc includedir.pc missing-requires-private.pc \
missing-requires.pc
missing-requires.pc idirafter.pc
DISTCLEANFILES = config.sh

15
check/check-idirafter Executable file
View file

@ -0,0 +1,15 @@
#! /bin/sh
# Make sure we're POSIX
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
fi
set -e
. ${srcdir}/common
ARGS="--cflags idirafter"
RESULT="-idirafter -I/after -I/foo -I/bar"
run_test

12
check/idirafter.pc Normal file
View file

@ -0,0 +1,12 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: idirafter test
Description: Dummy pkgconfig test package for testing pkgconfig
Version: 1.0.0
Requires:
Libs: -lsimple
Libs.private: -lm
Cflags: -I/foo -idirafter -I/after -I/bar

16
parse.c
View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2009 Tollef Fog Heen <tfheen@err.no>
* Copyright (C) 2006-2010 Tollef Fog Heen <tfheen@err.no>
* Copyright (C) 2001, 2002, 2005-2006 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
@ -849,12 +849,12 @@ parse_cflags (Package *pkg, const char *str, const char *path)
char *start;
start = arg;
p = start;
p = start;
if (p[0] == '-' &&
p[1] == 'I')
{
char *libname;
char *libname;
p += 2;
while (*p && isspace ((guchar)*p))
@ -870,13 +870,15 @@ parse_cflags (Package *pkg, const char *str, const char *path)
g_strconcat ("-I", libname, NULL));
g_free (libname);
}
else
{
} else {
if (*arg != '\0')
pkg->other_cflags = g_slist_prepend (pkg->other_cflags,
g_strdup (arg));
}
if (strcmp("-idirafter", arg) == 0) {
char *n = trim_string(argv[++i]);
pkg->other_cflags = g_slist_prepend(pkg->other_cflags, n);
}
}
g_free (arg);