Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
27c20971
Commit
27c20971
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
If 32b check at runtime the arch
parent
658bf42e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
project/Build.scala
+35
-15
35 additions, 15 deletions
project/Build.scala
with
35 additions
and
15 deletions
project/Build.scala
+
35
−
15
View file @
27c20971
...
...
@@ -6,21 +6,18 @@ object Leon extends Build {
private
val
scriptName
=
"leon"
def
scriptFile
=
file
(
"."
)
/
scriptName
def
is64
=
System
.
getProperty
(
"sun.arch.data.model"
)
==
"64"
def
ldLibraryDir
=
file
(
"."
)
/
(
if
(
is64
)
"lib64-bin"
else
"lib-bin"
)
def
ldLibraryDir32
=
file
(
"."
)
/
"lib-bin"
def
ldLibraryDir64
=
file
(
"."
)
/
"lib64-bin"
val
scriptTask
=
TaskKey
[
Unit
](
"script"
,
"Generate the "
+
scriptName
+
" Bash script"
)
<<=
(
streams
,
dependencyClasspath
in
Compile
,
classDirectory
in
Compile
)
map
{
(
s
,
deps
,
out
)
=>
if
(!
scriptFile
.
exists
)
{
s
.
log
.
info
(
"Generating script ("
+(
if
(
is64
)
"64b"
else
"32b"
)+
")..."
)
try
{
val
depsPaths
=
deps
.
map
(
_
.
data
.
absolutePath
).
filter
(
p
=>
if
(
p
.
endsWith
(
"unmanaged/z3.jar"
))
{
!
is64
}
else
if
(
p
.
endsWith
(
"unmanaged/z3-64.jar"
))
{
is64
}
else
{
true
}
)
val
depsPaths
=
deps
.
map
(
_
.
data
.
absolutePath
)
val
depsPaths64
=
depsPaths
.
filterNot
(
_
.
endsWith
(
"unmanaged/z3.jar"
))
val
depsPaths32
=
depsPaths
.
filterNot
(
_
.
endsWith
(
"unmanaged/z3-64.jar"
))
// One ugly hack... Likely to fail for Windows, but it's a Bash script anyway.
val
scalaHomeDir
=
depsPaths
.
find
(
_
.
endsWith
(
"lib/scala-library.jar"
))
match
{
case
None
=>
throw
new
Exception
(
"Couldn't guess SCALA_HOME."
)
...
...
@@ -31,14 +28,37 @@ object Leon extends Build {
val
nl
=
System
.
getProperty
(
"line.separator"
)
val
fw
=
new
java
.
io
.
FileWriter
(
scriptFile
)
fw
.
write
(
"#!/bin/bash --posix"
+
nl
)
fw
.
write
(
"SCALACLASSPATH=\""
)
fw
.
write
((
out
.
absolutePath
+:
depsPaths
).
mkString
(
":"
))
fw
.
write
(
"\""
+
nl
+
nl
)
if
(
is64
)
{
fw
.
write
(
"SCALACLASSPATH=\""
)
fw
.
write
((
out
.
absolutePath
+:
depsPaths64
).
mkString
(
":"
))
fw
.
write
(
"\""
+
nl
+
nl
)
// Setting the dynamic lib path
fw
.
write
(
"LIBRARY_PATH=\""
+
ldLibraryDir64
.
absolutePath
+
"\""
+
nl
)
}
else
{
fw
.
write
(
"if [ `uname -m` == \"x86_64\" ]; then "
+
nl
)
fw
.
write
(
"SCALACLASSPATH=\""
)
fw
.
write
((
out
.
absolutePath
+:
depsPaths64
).
mkString
(
":"
))
fw
.
write
(
"\""
+
nl
+
nl
)
// Setting the dynamic lib path
fw
.
write
(
"LIBRARY_PATH=\""
+
ldLibraryDir64
.
absolutePath
+
"\""
+
nl
)
// Setting the dynamic lib path
fw
.
write
(
"LD_LIBRARY_PATH=\""
+
ldLibraryDir
.
absolutePath
+
"\" \\"
+
nl
)
fw
.
write
(
"else"
+
nl
)
fw
.
write
(
"SCALACLASSPATH=\""
)
fw
.
write
((
out
.
absolutePath
+:
depsPaths32
).
mkString
(
":"
))
fw
.
write
(
"\""
+
nl
+
nl
)
// Setting the dynamic lib path
fw
.
write
(
"LIBRARY_PATH=\""
+
ldLibraryDir32
.
absolutePath
+
"\""
+
nl
)
fw
.
write
(
"fi"
+
nl
)
}
// the Java command that uses sbt's local Scala to run the whole contraption.
fw
.
write
(
"LD_LIBRARY_PATH=\"$LIBRARY_PATH\" \\"
+
nl
)
fw
.
write
(
"java -Xmx2G -Xms512M -classpath ${SCALACLASSPATH} -Dscala.home=\""
)
fw
.
write
(
scalaHomeDir
)
fw
.
write
(
"\" -Dscala.usejavacp=true "
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment