Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa3dfff8 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

Move mksh to external/mksh

Change-Id: I836b8764320bd498c335d97267d8b47acb97514d
parent eafcbe10
Loading
Loading
Loading
Loading

mksh/Android.mk

deleted100644 → 0
+0 −64
Original line number Original line Diff line number Diff line
# Copyright © 2010
#	Thorsten Glaser <t.glaser@tarent.de>
# This file is provided under the same terms as mksh.

LOCAL_PATH:=		$(call my-dir)


# /system/etc/mkshrc

include $(CLEAR_VARS)

LOCAL_MODULE:=		mkshrc
LOCAL_MODULE_TAGS:=	shell_mksh
LOCAL_MODULE_CLASS:=	ETC
LOCAL_MODULE_PATH:=	$(TARGET_OUT)/etc
LOCAL_SRC_FILES:=	$(LOCAL_MODULE)
include $(BUILD_PREBUILT)


# /system/bin/mksh

include $(CLEAR_VARS)

LOCAL_MODULE:=		mksh
LOCAL_MODULE_TAGS:=	shell_mksh

# mksh source files
LOCAL_SRC_FILES:=	src/lalloc.c src/edit.c src/eval.c src/exec.c \
			src/expr.c src/funcs.c src/histrap.c src/jobs.c \
			src/lex.c src/main.c src/misc.c src/shf.c \
			src/syn.c src/tree.c src/var.c

LOCAL_SYSTEM_SHARED_LIBRARIES:= libc

LOCAL_C_INCLUDES:=	$(LOCAL_PATH)/src
# additional flags first, then from Makefrag.inc: CFLAGS, CPPFLAGS
LOCAL_CFLAGS:=		-DMKSH_DEFAULT_EXECSHELL=\"/system/bin/sh\" \
			-DMKSH_DEFAULT_TMPDIR=\"/sqlite_stmt_journals\" \
			-DMKSHRC_PATH=\"/system/etc/mkshrc\" \
			-fwrapv \
			-DMKSH_ASSUME_UTF8=0 -DMKSH_NOPWNAM \
			-D_GNU_SOURCE \
			-DHAVE_ATTRIBUTE_BOUNDED=0 -DHAVE_ATTRIBUTE_FORMAT=1 \
			-DHAVE_ATTRIBUTE_NONNULL=1 -DHAVE_ATTRIBUTE_NORETURN=1 \
			-DHAVE_ATTRIBUTE_UNUSED=1 -DHAVE_ATTRIBUTE_USED=1 \
			-DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_MKDEV_H=0 \
			-DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_SYSMACROS_H=1 \
			-DHAVE_GRP_H=1 -DHAVE_LIBGEN_H=1 -DHAVE_LIBUTIL_H=0 \
			-DHAVE_PATHS_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDINT_H=1 \
			-DHAVE_STRINGS_H=1 -DHAVE_ULIMIT_H=0 -DHAVE_VALUES_H=0 \
			-DHAVE_CAN_INTTYPES=1 -DHAVE_CAN_UCBINTS=1 \
			-DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 \
			-DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 \
			-DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 \
			-DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 -DHAVE_MKNOD=0 \
			-DHAVE_MKSTEMP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=0 \
			-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
			-DHAVE_SETMODE=1 -DHAVE_SETRESUGID=1 \
			-DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \
			-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 \
			-DHAVE_REVOKE_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
			-DHAVE_PERSISTENT_HISTORY=0

include $(BUILD_EXECUTABLE)

mksh/MODULE_LICENSE_BSD_LIKE

deleted100644 → 0
+0 −0

Empty file deleted.

mksh/NOTICE

deleted100644 → 0
+0 −21
Original line number Original line Diff line number Diff line
mksh is covered by The MirOS Licence:

/*-
 * Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 *	Thorsten Glaser <tg@mirbsd.org>
 *
 * Provided that these terms and disclaimer and all copyright notices
 * are retained or reproduced in an accompanying document, permission
 * is granted to deal in this work without restriction, including un‐
 * limited rights to use, publicly perform, distribute, sell, modify,
 * merge, give away, or sublicence.
 *
 * This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
 * the utmost extent permitted by applicable law, neither express nor
 * implied; without malicious intent or gross negligence. In no event
 * may a licensor, author or contributor be held liable for indirect,
 * direct, other damage, loss, or other issues arising in any way out
 * of dealing in the work, even if advised of the possibility of such
 * damage or existence of a defect, except proven that it results out
 * of said person’s immediate fault when using the work as intended.
 */

mksh/mkmf.sh

deleted100644 → 0
+0 −124
Original line number Original line Diff line number Diff line
# Copyright © 2010
#	Thorsten Glaser <t.glaser@tarent.de>
# This file is provided under the same terms as mksh.
#-
# Helper script to let src/Build.sh generate Makefrag.inc
# which we in turn use in the manual creation of Android.mk
#
# This script is supposed to be run from/inside AOSP by the
# porter of mksh to Android (and only manually).

cd "$(dirname "$0")"
srcdir=$(pwd)
rm -rf tmp
mkdir tmp
cd ../../..
aospdir=$(pwd)
cd $srcdir/tmp

addvar() {
	_vn=$1; shift

	eval $_vn=\"\$$_vn '$*"'
}

CFLAGS=
CPPFLAGS=
LDFLAGS=
LIBS=

# The definitions below were generated by examining the
# output of the following command:
# make showcommands out/target/product/generic/system/bin/mksh 2>&1 | tee log
#
# They are only used to let Build.sh find the compiler, header
# files, linker and libraries to generate Makefrag.inc (similar
# to what GNU autotools’ configure scripts do), and never used
# during the real build process. We need this to port mksh to
# the Android platform and it is crucial these are as close as
# possible to the values used later. (You also must example the
# results gathered from Makefrag.inc to see they are the same
# across all Android platforms, or add appropriate ifdefs.)
# Since we no longer use the NDK, the AOSP has to have been
# built before using this script (targetting generic/emulator).

CC=$aospdir/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc
addvar CPPFLAGS -I$aospdir/system/core/include \
    -I$aospdir/hardware/libhardware/include \
    -I$aospdir/system/core/include \
    -I$aospdir/hardware/libhardware/include \
    -I$aospdir/hardware/libhardware_legacy/include \
    -I$aospdir/hardware/ril/include \
    -I$aospdir/dalvik/libnativehelper/include \
    -I$aospdir/frameworks/base/include \
    -I$aospdir/frameworks/base/opengl/include \
    -I$aospdir/external/skia/include \
    -I$aospdir/out/target/product/generic/obj/include \
    -I$aospdir/bionic/libc/arch-arm/include \
    -I$aospdir/bionic/libc/include \
    -I$aospdir/bionic/libstdc++/include \
    -I$aospdir/bionic/libc/kernel/common \
    -I$aospdir/bionic/libc/kernel/arch-arm \
    -I$aospdir/bionic/libm/include \
    -I$aospdir/bionic/libm/include/arch/arm \
    -I$aospdir/bionic/libthread_db/include \
    -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
    -I$aospdir/system/core/include/arch/linux-arm/ \
    -include $aospdir/system/core/include/arch/linux-arm/AndroidConfig.h \
    -DANDROID -DNDEBUG -UDEBUG
addvar CFLAGS -fno-exceptions -Wno-multichar -msoft-float -fpic \
    -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
    -march=armv5te -mtune=xscale -mthumb-interwork -fmessage-length=0 \
    -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type \
    -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point \
    -Wstrict-aliasing=2 -finline-functions -fno-inline-functions-called-once \
    -fgcse-after-reload -frerun-cse-after-loop -frename-registers -mthumb \
    -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
addvar LDFLAGS -nostdlib -Bdynamic -Wl,-T,$aospdir/build/core/armelf.x \
    -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections \
    -Wl,-z,nocopyreloc -Wl,--no-undefined \
    $aospdir/out/target/product/generic/obj/lib/crtbegin_dynamic.o
addvar LIBS -L$aospdir/out/target/product/generic/obj/lib \
    -Wl,-rpath-link=$aospdir/out/target/product/generic/obj/lib -lc \
    $aospdir/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a \
    $aospdir/out/target/product/generic/obj/lib/crtend_android.o


### Override flags
# We don’t even *support* UTF-8 by default ☹
addvar CPPFLAGS -DMKSH_ASSUME_UTF8=0
# No getpwnam() calls (affects "cd ~username/" only)
addvar CPPFLAGS -DMKSH_NOPWNAM
# Compile an extra small mksh (optional)
#addvar CPPFLAGS -DMKSH_SMALL
# Leave out the ulimit builtin
#addvar CPPFLAGS -DMKSH_NO_LIMITS

# Set target platform
TARGET_OS=Linux
# Building with -std=c99 or -std=gnu99 clashes with Bionic headers
HAVE_CAN_STDG99=0
HAVE_CAN_STDC99=0
export HAVE_CAN_STDG99 HAVE_CAN_STDC99

# Android-x86 does not have helper functions for ProPolice SSP
# and AOSP adds the flags by itself (same for warning flags)
HAVE_CAN_FNOSTRICTALIASING=0
HAVE_CAN_FSTACKPROTECTORALL=0
HAVE_CAN_WALL=0
export HAVE_CAN_FNOSTRICTALIASING HAVE_CAN_FSTACKPROTECTORALL HAVE_CAN_WALL

# disable the mknod(8) built-in to get rid of needing setmode.c
HAVE_MKNOD=0; export HAVE_MKNOD

# even the idea of persistent history on a phone is funny
HAVE_PERSISTENT_HISTORY=0; export HAVE_PERSISTENT_HISTORY

# ... and run it!
export CC CPPFLAGS CFLAGS LDFLAGS LIBS TARGET_OS
sh ../src/Build.sh -M
rv=$?
test x0 = x"$rv" && mv -f Makefrag.inc ../
cd ..
rm -rf tmp
exit $rv

mksh/mkshrc

deleted100644 → 0
+0 −29
Original line number Original line Diff line number Diff line
# Copyright (c) 2010
#	Thorsten Glaser <t.glaser@tarent.de>
# This file is provided under the same terms as mksh.
#-
# Minimal /system/etc/mkshrc for Android

: ${TERM:=vt100} ${HOME:=/data} ${MKSH:=/system/bin/sh} ${HOSTNAME:=android}
: ${SHELL:=$MKSH} ${USER:=$(typeset x=$(id); x=${x#*\(}; print -r -- ${x%%\)*})}
if (( USER_ID )); then PS1='$'; else PS1='#'; fi
function precmd {
	typeset e=$?

	(( e )) && print -n "$e|"
}
PS1='$(precmd)$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
export HOME HOSTNAME MKSH PS1 SHELL TERM USER
alias l='ls'
alias la='l -a'
alias ll='l -l'
alias lo='l -a -l'

for p in ~/.bin; do
	[[ -d $p/. ]] || continue
	[[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
done

unset p

: place customisations above this line
Loading