You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
6.7 KiB
205 lines
6.7 KiB
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../musl/parse-config-9 |
|
# Copyright (C) 2012 - 2013 The OpenSDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This program is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; version 2 of the License. A copy of the |
|
# GNU General Public License can be found in the file COPYING. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
if [ "$SDECFG_LIBC" == "musl" ]; then |
|
pkg_musl_dir=$base/package/base/musl |
|
|
|
if [ $pkg != "gettext" ]; then |
|
var_append flistdel "|" "usr/share/locale/locale.alias" |
|
fi |
|
|
|
# I don't know what this is for //morfoh |
|
var_append flistdel "|" "$( echo $libdir | cut -d '/' -f2- )/charset.alias" |
|
|
|
# cross-compiling help |
|
if atstage cross; then |
|
# assuming a gnu compatible malloc, realloc |
|
var_append configcache ' ' 'ac_cv_func_malloc_0_nonnull=yes' |
|
var_append configcache ' ' 'ac_cv_func_realloc_0_nonnull=yes' |
|
fi |
|
|
|
# the most tipical fix is to config.sub |
|
# |
|
musl_fix_configsub() { |
|
local x; for x; do |
|
echo_warning "Adding linux-musl target support to $x" |
|
echo "musl_fix_configsub: adding musl_arch_target support to $x" |
|
cp -f $x $x.orig |
|
sed -e 's,\([-]\?linux\)-gnu\*,\1-gnu\* | \1-musl\*,g' $x.orig > $x |
|
diff -u $x.orig $x || true |
|
done |
|
} |
|
musl_auto_fix_configsub() { |
|
local f |
|
for f in . ./build-aux ./config ./support; do |
|
if [ -e $f/config.sub ] ; then |
|
if ! grep -q '\-musl' $f/config.sub; then |
|
musl_fix_configsub $f/config.sub |
|
fi |
|
fi |
|
done |
|
} |
|
musl_findall_fix_configsub() { |
|
local f |
|
for f in `find . -name config.sub`; do |
|
musl_fix_configsub $f |
|
done |
|
} |
|
|
|
|
|
# FIXME: i forgot what makes musl_fix_addcases different than musl_fix_configsub //mnemoc |
|
musl_fix_addcases() { |
|
local file; for file; do |
|
echo "musl_fix_addcases: adding *-linux-musl* support to $file" |
|
cp -f $file $file.orig |
|
sed -i -e 's,\([^ ]*\)linux-gnu\*\(.*\)\([\)\\]\),\1linux-gnu* | \1linux-musl*\2\3,g' $file |
|
diff -u $file.orig $file || true |
|
done |
|
} |
|
|
|
musl_fix_addcases2() { |
|
local file; for file; do |
|
echo "musl_fix_addcases2: adding *-linux-musl* support to $file" |
|
cp -f $file $file.orig |
|
sed -i -e 's,\( *.*\)linux-gnu\*)\(.*\)\;\;$,\1linux-musl*)\2;;\n\1linux-gnu*)\2;;,g' \ |
|
-e 's,\( *.*\)linux-gnu\*)\(.*[^;][^;]\)$,\1linux-musl* \| \\\n\1linux-gnu*)\2,g' \ |
|
$file |
|
diff -u $file.orig $file || true |
|
done |
|
} |
|
# fix typical locations |
|
hook_add postpatch 5 'musl_auto_fix_configsub' |
|
|
|
# fix issues with included gnulib |
|
# http://openwall.com/lists/musl/2012/06/19/13 |
|
musl_fix_gnulib() { |
|
local dir="$1" |
|
|
|
echo_status "fixing gnulib weirdness in $dir" |
|
|
|
gl_config_cache=" |
|
gl_cv_func_isnanl_works=yes \ |
|
gl_cv_header_working_stdint_h=yes \ |
|
gl_cv_func_fpurge_works=yes \ |
|
gl_cv_func_fcntl_f_dupfd_cloexec=yes \ |
|
gl_cv_func_getcwd_path_max=yes \ |
|
gl_cv_func_fprintf_posix=yes \ |
|
gl_cv_func_printf_sizes_c99=yes \ |
|
gl_cv_func_printf_long_double=yes \ |
|
gl_cv_func_printf_infinite=yes \ |
|
gl_cv_func_printf_infinite_long_double=yes \ |
|
gl_cv_func_printf_directive_a=yes \ |
|
gl_cv_func_printf_directive_f=yes \ |
|
gl_cv_func_printf_directive_n=yes \ |
|
gl_cv_func_printf_directive_ls=yes \ |
|
gl_cv_func_printf_positions=yes \ |
|
gl_cv_func_printf_flag_grouping=yes \ |
|
gl_cv_func_printf_flag_leftadjust=yes \ |
|
gl_cv_func_printf_flag_zero=yes \ |
|
gl_cv_func_printf_precision=yes \ |
|
gl_cv_func_printf_enomem=yes" |
|
|
|
for x in $gl_config_cache; do |
|
var_append configcache ' ' "$x" |
|
done |
|
|
|
empty_file() { |
|
echo "gnulib fix: emptying file $1" |
|
rm -f $1 |
|
touch $1 |
|
} |
|
|
|
for x in fseterr.c freadahead.c fseeko.c; do |
|
empty_file "$dir/$x" |
|
done |
|
echo "void close_stdin(void) {}" > "$dir"/closein.c |
|
|
|
echo "#include <stdio_ext.h>" > "$dir"/fseterr.h |
|
echo "#define fseterr(fp) __fseterr (fp)" >> "$dir"/fseterr.h |
|
echo "#include "fseterr.h"" > "$dir"/fsetserr.c |
|
|
|
# fix stuff trying to reimplement libc |
|
culprits="accept4 acosl alloca alphasort asinl asprintf atanl \ |
|
atexit atoll bcopy btowc chown closedir cosl dirfd \ |
|
dprintf dup2 dup3 _Exit expl fchdir fchown-stub \ |
|
fdatasync fdopendir ffs flock fnmatch forkpty fpending \ |
|
fprintf freeaddrinfo fsync ftell ftruncate futimens \ |
|
gai_strerror getaddrinfo getdelim getdtablesize \ |
|
getgroups gethostname getline getlogin getlogin_r \ |
|
getnameinfo getpagesize getpass getsubopt gettimeofday \ |
|
getusershell gmtime_r grantpt imaxabs imaxdiv inet_ntop \ |
|
inet_pton isblank iswblank lchmod lchown ldexp ldexpl \ |
|
link linkat logl mbrlen mbrtowc mbsinit memmove mempcpy \ |
|
mkdtemp mkfifo mkfifoat mknod mknodat mkstemp mktime \ |
|
nanosleep nl_langinfo open openat opendir openpty pclose \ |
|
perror pipe pipe2 poll popen pread pselect ptsname \ |
|
pwrite raise readdir readlink renameat rewinddir setenv \ |
|
sigaction sigaddset sigdelset sigemptyset sigfillset \ |
|
sigismember sigpending sigprocmask sinl snprintf \ |
|
spawnattr_destroy spawnattr_getdefault spawnattr_getflags \ |
|
spawnattr_getpgroup spawnattr_getsigmask spawnattr_init \ |
|
spawnattr_setdefault.c spawnattr_setflags spawnattr_setpgroup \ |
|
spawnattr_setsigmask spawn_faction_addclose \ |
|
spawn_faction_adddup2 spawn_faction_addopen \ |
|
spawn_faction_destroy spawn_faction_init \ |
|
spawn_factions_addopen spawn_factions_destroy \ |
|
spawn_factions_init sprintf sqrtl stdio-read stdio-write \ |
|
strcasecmp strcasestr strchrnul strcspn strncasecmp \ |
|
strndup strnlen strpbrk strsep strsignal strstr strtod \ |
|
strtoimax strtol symlink symlinkat tanl tcgetsid timegm \ |
|
time_r times tmpfile uname unlockpt unsetenv usleep \ |
|
vasprintf vdprintf waitpid wcrtomb wctob" |
|
|
|
#for x in $culprits ; do empty_file "$dir/$x.c" ; done |
|
} |
|
|
|
# and some others |
|
case "$pkg" in |
|
binutils) |
|
hook_add postpatch 4 'musl_fix_addcases ./bfd/config.bfd ./bfd/configure \ |
|
./bfd/configure.in ./ld/configure.tgt' |
|
hook_add postpatch 5 'musl_fix_addcases2 ./gas/configure ./gas/configure.in' |
|
;; |
|
gmp) |
|
hook_add postpatch 6 'musl_fix_configsub configfsf.sub' |
|
;; |
|
libtool) |
|
hook_add preconf 9 'musl_findall_fix_configsub' |
|
;; |
|
|
|
# packages to fix gnulib weirdness |
|
m4) |
|
hook_add preconf 9 'musl_fix_gnulib lib' |
|
;; |
|
|
|
esac |
|
|
|
# same package translations to look for patches |
|
case "$pkg" in |
|
linux*|linux-header) |
|
pkg_musl_pkg=linux ;; |
|
*) |
|
pkg_musl_pkg=${pkg} ;; |
|
esac |
|
|
|
pkg_musl_patches=$( ls -1 $pkg_musl_dir/pkg/$pkg_musl_pkg/*.patch 2> /dev/null | tr '\n' ' ' ) |
|
if [ -n "$pkg_musl_patches" ]; then |
|
echo_status "musl: appending patches ..." |
|
var_append patchfiles ' ' "$pkg_musl_patches" |
|
fi |
|
|
|
if [ -f $pkg_musl_dir/pkg/$pkg/$pkg.conf ]; then |
|
. $pkg_musl_dir/pkg/$pkg/$pkg.conf |
|
fi |
|
fi
|
|
|