gnulibfix (2111B)
1 #!/bin/sh 2 empty_file() { 3 rm -f "$1" 4 touch "$1" 5 } 6 7 dir="$1" 8 # fix files breaking the build entirely 9 for i in freadahead.c fseterr.c ; do empty_file "$dir"/$i ; done 10 echo "void close_stdin(void) {}" > "$dir"/closein.c 11 12 # fix stuff trying to reimplement libc 13 culprits=`cat << EOF 14 accept4 15 acosl 16 alloca 17 alphasort 18 asinl 19 asprintf 20 atanl 21 atexit 22 atoll 23 bcopy 24 btowc 25 chown 26 closedir 27 cosl 28 dirfd 29 dprintf 30 dup2 31 dup3 32 _Exit 33 expl 34 fchdir 35 fchown-stub 36 fdatasync 37 fdopendir 38 ffs 39 flock 40 fnmatch 41 forkpty 42 fpending 43 fprintf 44 freeaddrinfo 45 fsync 46 ftell 47 ftruncate 48 futimens 49 gai_strerror 50 getaddrinfo 51 getdelim 52 getdtablesize 53 getgroups 54 gethostname 55 getline 56 getlogin 57 getlogin_r 58 getnameinfo 59 getpagesize 60 getpass 61 getsubopt 62 gettimeofday 63 getusershell 64 gmtime_r 65 grantpt 66 imaxabs 67 imaxdiv 68 inet_ntop 69 inet_pton 70 isblank 71 iswblank 72 lchmod 73 lchown 74 ldexp 75 ldexpl 76 link 77 linkat 78 logl 79 mbrlen 80 mbrtowc 81 mbsinit 82 memmove 83 mempcpy 84 mkdtemp 85 mkfifo 86 mkfifoat 87 mknod 88 mknodat 89 mkstemp 90 mktime 91 nanosleep 92 nl_langinfo 93 open 94 openat 95 opendir 96 openpty 97 pclose 98 perror 99 pipe 100 pipe2 101 poll 102 popen 103 pread 104 pselect 105 ptsname 106 pwrite 107 raise 108 readdir 109 readlink 110 renameat 111 rewinddir 112 setenv 113 sigaction 114 sigaddset 115 sigdelset 116 sigemptyset 117 sigfillset 118 sigismember 119 sigpending 120 sigprocmask 121 sinl 122 snprintf 123 spawnattr_destroy 124 spawnattr_getdefault 125 spawnattr_getflags 126 spawnattr_getpgroup 127 spawnattr_getsigmask 128 spawnattr_init 129 spawnattr_setdefault.c 130 spawnattr_setflags 131 spawnattr_setpgroup 132 spawnattr_setsigmask 133 spawn_faction_addclose 134 spawn_faction_adddup2 135 spawn_faction_addopen 136 spawn_faction_destroy 137 spawn_faction_init 138 spawn_factions_addopen 139 spawn_factions_destroy 140 spawn_factions_init 141 sprintf 142 sqrtl 143 stdio-read 144 stdio-write 145 strcasecmp 146 strcasestr 147 strchrnul 148 strcspn 149 strncasecmp 150 strndup 151 strnlen 152 strpbrk 153 strsep 154 strsignal 155 strstr 156 strtod 157 strtoimax 158 strtol 159 symlink 160 symlinkat 161 tanl 162 tcgetsid 163 timegm 164 time_r 165 times 166 tmpfile 167 uname 168 unlockpt 169 unsetenv 170 usleep 171 vasprintf 172 vdprintf 173 waitpid 174 wcrtomb 175 wctob 176 EOF 177 ` 178 #fixme check fsusage 179 flags="-Drpl_tzset=tzset -Drpl_localtime=localtime -Dgnu_fnmatch=fnmatch \ 180 -Dposix_fnmatch=fnmatch -Drpl_gmtime=gmtime" 181 for i in $culprits ; do 182 empty_file "$dir"/$i.c 183 flags="$flags -Drpl_$i=$i" 184 done 185 printf "%s\n" "$flags"