aboutsummaryrefslogtreecommitdiff
path: root/project/native.scala
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2015-11-01 21:07:12 -0800
committerJakob Odersky <jodersky@gmail.com>2015-11-16 23:27:53 -0800
commit628debc2a1d04dc367e5e76858b754f1ddb6141f (patch)
treef32b2b8776f363147f1fb380adc3e15cd9912296 /project/native.scala
parent9328cb2b61751472b6abe9c57502ecef79d3d069 (diff)
downloadakka-serial-cygwin.tar.gz
akka-serial-cygwin.tar.bz2
akka-serial-cygwin.zip
Enable build for Cygwincygwin
Diffstat (limited to 'project/native.scala')
-rw-r--r--project/native.scala26
1 files changed, 23 insertions, 3 deletions
diff --git a/project/native.scala b/project/native.scala
index b6e4c19..5fb87ce 100644
--- a/project/native.scala
+++ b/project/native.scala
@@ -48,6 +48,26 @@ object NativeKeys {
}
+//windows, as usual, needs special treatment
+object CygwinUtil {
+
+ def onCygwin: Boolean = {
+ val uname = Process("uname").lines.headOption
+ uname map {
+ _.toLowerCase.startsWith("cygwin")
+ } getOrElse {
+ false
+ }
+ }
+
+ def toUnixPath(path: String): String = if (onCygwin) {
+ Process(s"cygpath ${path}").lines.head
+ } else {
+ path
+ }
+
+}
+
/** Provides implementations of wrapper tasks suitable for projects using Autotools */
object Autotools {
import NativeKeys._
@@ -64,14 +84,14 @@ object Autotools {
val log = streams.value.log
val src = (sourceDirectory in Native).value
val out = (target in Native).value
- val outPath = out.getAbsolutePath
+ val outPath = CygwinUtil.toUnixPath(out.getAbsolutePath)
val configure = if ((src / "config.status").exists) {
- Process("./config.status", src)
+ Process("sh ./config.status", src)
} else {
Process(
//Disable producing versioned library files, not needed for fat jars.
- s"./configure --prefix=$outPath --libdir=$outPath --disable-versioned-lib",
+ s"sh ./configure --prefix=$outPath --libdir=$outPath --disable-versioned-lib",
src
)
}