mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-19 07:15:34 -04:00
Add cross-compilation script
This commit is contained in:
parent
a5b0befba1
commit
d20df210d0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
micro
|
micro
|
||||||
|
binaries/
|
||||||
|
2
Makefile
2
Makefile
@ -7,4 +7,4 @@ install: syn-files
|
|||||||
|
|
||||||
syn-files:
|
syn-files:
|
||||||
mkdir -p ~/.micro/syntax
|
mkdir -p ~/.micro/syntax
|
||||||
cp syntax_files/* ~/.micro/syntax
|
./runtime/install.sh
|
||||||
|
44
cross-compile.sh
Executable file
44
cross-compile.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
mkdir -p binaries
|
||||||
|
mkdir -p micro/bin
|
||||||
|
cp -r runtime micro/
|
||||||
|
|
||||||
|
echo 'mv runtime ~/.micro' >> micro/install.sh
|
||||||
|
chmod +x micro/install.sh
|
||||||
|
|
||||||
|
# Mac
|
||||||
|
echo "OSX 64"
|
||||||
|
GOOS=darwin GOARCH=amd64 go build -o micro/bin/micro ./src
|
||||||
|
tar -czf micro-osx.tar.gz micro
|
||||||
|
mv micro-osx.tar.gz binaries
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
echo "Linux 64"
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o micro/bin/micro ./src
|
||||||
|
tar -czf micro-linux64.tar.gz micro
|
||||||
|
mv micro-linux64.tar.gz binaries
|
||||||
|
echo "Linux 32"
|
||||||
|
GOOS=linux GOARCH=386 go build -o micro/bin/micro ./src
|
||||||
|
tar -czf micro-linux32.tar.gz micro
|
||||||
|
mv micro-linux32.tar.gz binaries
|
||||||
|
echo "Linux arm"
|
||||||
|
GOOS=linux GOARCH=arm go build -o micro/bin/micro ./src
|
||||||
|
tar -czf micro-linux-arm.tar.gz micro
|
||||||
|
mv micro-linux-arm.tar.gz binaries
|
||||||
|
|
||||||
|
rm micro/bin/micro
|
||||||
|
rm micro/install.sh
|
||||||
|
|
||||||
|
echo 'move runtime %HOMEPATH%\.micro' >> micro/install.bat
|
||||||
|
chmod +x micro/install.bat
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
echo "Windows 64"
|
||||||
|
GOOS=windows GOARCH=amd64 go build -o micro/bin/micro.exe ./src
|
||||||
|
zip -r -q -T micro-win64.zip micro
|
||||||
|
mv micro-win64.zip binaries
|
||||||
|
echo "Windows 32"
|
||||||
|
GOOS=windows GOARCH=386 go build -o micro/bin/micro.exe ./src
|
||||||
|
zip -r -q -T micro-win32.zip micro
|
||||||
|
mv micro-win32.zip binaries
|
||||||
|
|
||||||
|
rm -rf micro
|
3
runtime/README.md
Normal file
3
runtime/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Runtime files for Micro
|
||||||
|
|
||||||
|
The contents of this directory should be put in `~/.micro`.
|
@ -1,7 +1,7 @@
|
|||||||
# Micro syntax highlighting files
|
# Micro syntax highlighting files
|
||||||
|
|
||||||
These are the syntax highlighting files for micro. To install them, just
|
These are the syntax highlighting files for micro. To install them, just
|
||||||
put them all in `~/.micro/syntax`.
|
run `./install.sh` one directory up (`runtime/`) which will simply put all the syntax files in `~/.micro/syntax`.
|
||||||
|
|
||||||
They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc).
|
They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc).
|
||||||
Micro syntax files are almost identical to Nano's, except for some key differences:
|
Micro syntax files are almost identical to Nano's, except for some key differences:
|
@ -149,9 +149,9 @@ func Match(rules string, buf *Buffer, v *View) map[int]tcell.Style {
|
|||||||
color := string(submatch[1])
|
color := string(submatch[1])
|
||||||
var regexStr string
|
var regexStr string
|
||||||
if len(submatch) == 4 {
|
if len(submatch) == 4 {
|
||||||
regexStr = "(?m" + string(submatch[2]) + ")" + string(submatch[3])
|
regexStr = "(?m" + string(submatch[2]) + ")" + JoinRule(string(submatch[3]))
|
||||||
} else if len(submatch) == 3 {
|
} else if len(submatch) == 3 {
|
||||||
regexStr = "(?m)" + string(submatch[2])
|
regexStr = "(?m)" + JoinRule(string(submatch[2]))
|
||||||
}
|
}
|
||||||
regex, err := regexp.Compile(regexStr)
|
regex, err := regexp.Compile(regexStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -268,7 +268,7 @@ func (v *View) HandleEvent(event tcell.Event) int {
|
|||||||
v.ScrollDown(1)
|
v.ScrollDown(1)
|
||||||
y = v.height + v.topline - 1
|
y = v.height + v.topline - 1
|
||||||
}
|
}
|
||||||
if y > len(v.buf.lines) {
|
if y >= len(v.buf.lines) {
|
||||||
y = len(v.buf.lines) - 1
|
y = len(v.buf.lines) - 1
|
||||||
}
|
}
|
||||||
if x < 0 {
|
if x < 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user