Skip to content

Commit

Permalink
First series of changes for iOS. Compiles, but not fully thread local
Browse files Browse the repository at this point in the history
yet
  • Loading branch information
N-Holzschuch committed Nov 3, 2019
1 parent 757bd2e commit acce13f
Show file tree
Hide file tree
Showing 38 changed files with 12,877 additions and 16 deletions.
55 changes: 55 additions & 0 deletions basic_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18C54</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>pythonA-kiwisolver</string>
<key>CFBundleIdentifier</key>
<string>Nicolas-Holzschuch.pythonA-kiwisolver</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>pythonA-kiwisolver</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>16B91</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>11.0</string>
<key>DTSDKBuild</key>
<string>16B91</string>
<key>DTSDKName</key>
<string>iphoneos11.0</string>
<key>DTXcode</key>
<string>1010</string>
<key>DTXcodeBuild</key>
<string>10B61</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>
43 changes: 43 additions & 0 deletions build_vim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#! /bin/sh
# vim_cv_terminfo = ?? yes or no ?? If yes, will have to set it
# vim_cv_stat_ignores_slash = unknown. Test with yes, rerun with no
# All stuff with tgetent / terminfo will have to be hardcoded
# tty_group too.
# vim_cv_memmove_handles_overlap = set to no for safety
# vim_cv_memcpy_handles_overlap = same

# -g2 for debugging

# 1) configure
./configure vim_cv_toupper_broken=no vim_cv_terminfo=no vim_cv_tgetent=zero vim_cv_memmove_handles_overlap=no vim_cv_memcpy_handles_overlap=no vim_cv_bcopy_handles_overlap=no vim_cv_tty_group=world vim_cv_stat_ignores_slash=yes vim_cv_getcwd_broken=no LUA_PREFIX=${PWD} vi_cv_path_plain_lua=/usr/bin/lua vi_cv_version_plain_lua=5.3.4 --with-tlib=ncurses --with-features=big --enable-terminal --enable-luainterp --enable-python3interp --with-python3-command=python3 CC=clang CXX=clang++ CFLAGS="-DEXITFREE -arch arm64 -g2 -miphoneos-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -fembed-bitcode" CPPFLAGS="-DEXITFREE -arch arm64 -g2 -miphoneos-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/" CXXFLAGS="-DEXITFREE -arch arm64 -g2 -miphoneos-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -fembed-bitcode" LDFLAGS="-shared -arch arm64 -g2 -miphoneos-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ " --build=x86_64-apple-darwin --host=armv7-apple-darwin

# 2) make. This creates ./src/vim, a Mach-O 64-bit dynamically linked shared library for arm64.
make

# 3)
echo "Creating: " Frameworks/vim.framework
framework=vim
libraryFile=src/vim
rm -rf Frameworks/$framework.framework
mkdir -p Frameworks/$framework.framework
cp $libraryFile Frameworks/$framework.framework/$framework
cp basic_Info.plist Frameworks/$framework.framework/Info.plist
plutil -replace CFBundleExecutable -string $framework Frameworks/$framework.framework/Info.plist
plutil -replace CFBundleName -string $framework Frameworks/$framework.framework/Info.plist
# underscore is not allowed in CFBundleIdentifier:
signature=${framework//_/-}
plutil -replace CFBundleIdentifier -string Nicolas-Holzschuch.$signature Frameworks/$framework.framework/Info.plist
install_name_tool -id @rpath/$framework.framework/$framework Frameworks/$framework.framework/$framework


# DONE: add LDFLAGS
# DONE: compile as dylib, not executable
# DONE: add ios_system
# DONE: test inside a-shell
# DONE: forward input
# DONE: remove -g2
# DONE: replace fork with ios_fork, wait for streams.
# DONE: provide missing termcap functions, from hterm POV
# DONE: see termlib.c for help
# TODO: add Python & Lua support (FEAT_PYTHON, FEAT_LUA...)
# DONE: remove /bin/sh from shell commands
52 changes: 52 additions & 0 deletions build_vim_simulator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#! /bin/sh
# vim_cv_terminfo = ?? yes or no ?? If yes, will have to set it
# vim_cv_stat_ignores_slash = unknown. Test with yes, rerun with no
# All stuff with tgetent / terminfo will have to be hardcoded
# tty_group too.
# vim_cv_memmove_handles_overlap = set to no for safety
# vim_cv_memcpy_handles_overlap = same

# 1) configure
./configure vim_cv_toupper_broken=no vim_cv_terminfo=no vim_cv_tgetent=zero vim_cv_memmove_handles_overlap=no vim_cv_memcpy_handles_overlap=no vim_cv_bcopy_handles_overlap=no vim_cv_tty_group=world vim_cv_stat_ignores_slash=yes vim_cv_getcwd_broken=no --with-tlib=ncurses --with-features=big --enable-terminal CC=clang CXX=clang++ CFLAGS="-DEXITFREE -g2 -mios-simulator-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/ -fembed-bitcode" CPPFLAGS="-DEXITFREE -g2 -mios-simulator-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/" CXXFLAGS="-DEXITFREE -g2 -mios-simulator-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/ -fembed-bitcode" LDFLAGS="-g2 -shared -mios-simulator-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/ -fembed-bitcode" --build=x86_64-apple-darwin --host=armv7-apple-darwin

# 2) make. This creates ./src/vim, a Mach-O 64-bit dynamically linked shared library for arm64.
make

# 3)
echo "Creating: " Frameworks/vim.framework
framework=vim
libraryFile=src/vim
rm -rf Frameworks/$framework.framework
mkdir -p Frameworks/$framework.framework
cp $libraryFile Frameworks/$framework.framework/$framework
cp basic_Info.plist Frameworks/$framework.framework/Info.plist
plutil -replace CFBundleExecutable -string $framework Frameworks/$framework.framework/Info.plist
plutil -replace CFBundleName -string $framework Frameworks/$framework.framework/Info.plist
# underscore is not allowed in CFBundleIdentifier:
signature=${framework//_/-}
plutil -replace CFBundleIdentifier -string Nicolas-Holzschuch.$signature Frameworks/$framework.framework/Info.plist
install_name_tool -id @rpath/$framework.framework/$framework Frameworks/$framework.framework/$framework


# DONE: add LDFLAGS
# DONE: compile as dylib, not executable
# DONE: add ios_system
# DONE: test inside a-shell
# DONE: forward input
# DONE: memory issues (again)
# DONE: remove tgetstr, tputs, etc;
# DONE: replace fork with ios_fork, wait for streams.
# DONE: provide missing termcap functions, from hterm POV
# DONE: see termlib.c for help
# TODO: add Python & Lua support (FEAT_PYTHON, FEAT_LUA...)
# DONE: remove /bin/sh from shell commands
# DONE: send resize events to vim, one way or another
# TODO: avoid compose events in command mode. HOW? (sucks for everyone, though)
# TODO: visual bell

# a-shell:
# DONE: remove insert mode in hterm.html, always in overwrite
# TODO: empjis need multiple characters. CJK works here, why not emojis?
# TODO: move javascript out of hterm.html, into myown.js
# Check that toolbar stays on always (?)

24 changes: 24 additions & 0 deletions include/lapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $
** Auxiliary functions from Lua API
** See Copyright Notice in lua.h
*/

#ifndef lapi_h
#define lapi_h


#include "llimits.h"
#include "lstate.h"

#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \
"stack overflow");}

#define adjustresults(L,nres) \
{ if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }

#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \
"not enough elements in the stack")


#endif
Loading

0 comments on commit acce13f

Please sign in to comment.