Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
19d0961a
Commit
19d0961a
authored
Jul 29, 2014
by
Peter Sankauskas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cross-compile' into chroot-hvm
parents
e39f555f
ac44f417
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
scripts/linuxcompile.sh
scripts/linuxcompile.sh
+60
-0
No files found.
scripts/linuxcompile.sh
0 → 100755
View file @
19d0961a
#!/bin/bash
#
# To be able to cross compile:
# cd /usr/local/go/src
# sudo GOOS=linux GOARCH=amd64 ./make.bash --no-clean
#
# This script only builds the application from source.
set
-e
NO_COLOR
=
"
\x
1b[0m"
OK_COLOR
=
"
\x
1b[32;01m"
ERROR_COLOR
=
"
\x
1b[31;01m"
WARN_COLOR
=
"
\x
1b[33;01m"
# http://stackoverflow.com/questions/4023830/bash-how-compare-two-strings-in-version-format
verify_go
()
{
if
[[
$1
==
$2
]]
;
then
return
0
fi
local
IFS
=
.
local
i
ver1
=(
$1
)
ver2
=(
$2
)
for
((
i
=
${#
ver1
[@]
}
;
i<
${#
ver2
[@]
}
;
i++
))
;
do
ver1[i]
=
0
done
for
((
i
=
0
;
i<
${#
ver1
[@]
}
;
i++
))
;
do
if
[[
-z
${
ver2
[i]
}
]]
;
then
ver2[i]
=
0
fi
if
((
10#
${
ver1
[i]
}
>
10#
${
ver2
[i]
}
))
;
then
echo
-e
"
${
ERROR_COLOR
}
==> Required Go version
$1
not installed. Found
$2
instead"
exit
1
fi
done
}
GO_MINIMUM_VERSION
=
1.2
GO_INSTALLED_VERSION
=
$(
go version |
cut
-d
' '
-f
3
)
GO_INSTALLED_VERSION
=
${
GO_INSTALLED_VERSION
#
"go"
}
echo
-e
"
${
OK_COLOR
}
==> Verifying Go"
verify_go
$GO_MINIMUM_VERSION
$GO_INSTALLED_VERSION
# Get the parent directory of where this script is.
SOURCE
=
"
${
BASH_SOURCE
[0]
}
"
while
[
-h
"
$SOURCE
"
]
;
do
SOURCE
=
"
$(
readlink
"
$SOURCE
"
)
"
;
done
DIR
=
"
$(
cd
-P
"
$(
dirname
"
$SOURCE
"
)
/.."
&&
pwd
)
"
# Change into that directory
cd
$DIR
# Compile the thing
export
XC_ARCH
=
amd64
export
XC_OS
=
linux
./scripts/compile.sh
echo
"-- DONE --"
echo
"Binaries are in ./pkg/linux_amd64/"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment