Skip to content

Commit 4a358c8

Browse files
committed
Popen and shared library init are broken on Android 2.3
1 parent d0bceab commit 4a358c8

7 files changed

+28
-8
lines changed

android/build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ $BUILDDIR/setCrossEnvironment.sh \
421421
--host=$TARGET_HOST \
422422
--disable-arm-iwmmxt
423423

424+
sed -i "s/TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR/DISABLE_TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR/g" config.h
425+
424426
cd pixman
425427
touch *.S
426428

android/setCrossEnvironment-armeabi-v7a.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
2323
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
2424
GCCPREFIX=arm-linux-androideabi
2525
GCCVER=4.8
26-
PLATFORMVER=android-14
26+
PLATFORMVER=android-9
2727
LOCAL_PATH=`dirname $0`
2828
if which realpath > /dev/null ; then
2929
LOCAL_PATH=`realpath $LOCAL_PATH`

android/setCrossEnvironment-armeabi.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
2323
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
2424
GCCPREFIX=arm-linux-androideabi
2525
GCCVER=4.8
26-
PLATFORMVER=android-14
26+
PLATFORMVER=android-9
2727
LOCAL_PATH=`dirname $0`
2828
if which realpath > /dev/null ; then
2929
LOCAL_PATH=`realpath $LOCAL_PATH`

android/setCrossEnvironment-mips.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
2323
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
2424
GCCPREFIX=mipsel-linux-android
2525
GCCVER=4.8
26-
PLATFORMVER=android-14
26+
PLATFORMVER=android-9
2727
LOCAL_PATH=`dirname $0`
2828
if which realpath > /dev/null ; then
2929
LOCAL_PATH=`realpath $LOCAL_PATH`

android/setCrossEnvironment-x86.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
2323
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
2424
GCCPREFIX=i686-linux-android
2525
GCCVER=4.8
26-
PLATFORMVER=android-14
26+
PLATFORMVER=android-9
2727
LOCAL_PATH=`dirname $0`
2828
if which realpath > /dev/null ; then
2929
LOCAL_PATH=`realpath $LOCAL_PATH`

os/utils.c

+12
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,9 @@ OsAbort (void)
12441244
int
12451245
System(char *command)
12461246
{
1247+
#ifdef ANDROID
1248+
return system(command);
1249+
#else
12471250
int pid, p;
12481251
void (*csig)(int);
12491252
int status;
@@ -1281,6 +1284,7 @@ System(char *command)
12811284
}
12821285

12831286
return p == -1 ? -1 : status;
1287+
#endif
12841288
}
12851289

12861290
static struct pid {
@@ -1294,6 +1298,9 @@ OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
12941298
pointer
12951299
Popen(char *command, char *type)
12961300
{
1301+
#ifdef ANDROID
1302+
return popen(command, type);
1303+
#else
12971304
struct pid *cur;
12981305
FILE *iop;
12991306
int pdes[2], pid;
@@ -1374,6 +1381,7 @@ Popen(char *command, char *type)
13741381
DebugF("Popen: `%s', fp = %p\n", command, iop);
13751382

13761383
return iop;
1384+
#endif
13771385
}
13781386

13791387
/* fopen that drops privileges */
@@ -1471,6 +1479,9 @@ Fopen(char *file, char *type)
14711479
int
14721480
Pclose(pointer iop)
14731481
{
1482+
#ifdef ANDROID
1483+
return pclose(iop);
1484+
#else
14741485
struct pid *cur, *last;
14751486
int pstat;
14761487
int pid;
@@ -1503,6 +1514,7 @@ Pclose(pointer iop)
15031514
}
15041515

15051516
return pid == -1 ? -1 : pstat;
1517+
#endif
15061518
}
15071519

15081520
int

xkb/ddxLoad.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,23 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
205205
}
206206
}
207207

208+
out = fopen("x-keyboard.txt", "w");
209+
if (out) {
210+
XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
211+
fclose(out);
212+
}
213+
208214
if (asprintf(&buf,
209-
"%s%sxkbcomp -I%s/usr/share/X11/xkb -w %d %s -xkm %s "
210-
"-em1 %s -emp %s -eml %s %s%s.xkm",
215+
"cat x-keyboard.txt | %s%sxkbcomp -I%s/usr/share/X11/xkb -w %d %s -xkm %s "
216+
"-em1 %s -emp %s -eml %s %s%s.xkm 2>%s/popen-stderr.txt",
211217
xkbbindir, xkbbindirsep,
212218
(getenv("SECURE_STORAGE_DIR") ? getenv("SECURE_STORAGE_DIR") : ""),
213219
((xkbDebugFlags < 2) ? 1 :
214220
((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
215221
xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
216222
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
217-
xkm_output_dir, keymap) == -1)
223+
xkm_output_dir, keymap,
224+
(getenv("SECURE_STORAGE_DIR") ? getenv("SECURE_STORAGE_DIR") : ".")) == -1)
218225
buf = NULL;
219226

220227
free(xkbbasedirflag);
@@ -237,7 +244,6 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
237244
XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
238245
}
239246
#endif
240-
XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
241247
#ifndef WIN32
242248
if (Pclose(out)==0)
243249
#else

0 commit comments

Comments
 (0)