Skip to content

Commit

Permalink
macOS aarch64 libsass for Apple M1 (#49)
Browse files Browse the repository at this point in the history
* Dependencies updated and macOS aarch64 libsass for Apple M1

* Using the last version of sbt

* Using the last version of sbt

* Using the last version of sbt

* Using the last version of sbt

* sbt and dependencies updated
  • Loading branch information
porchy13 authored Feb 28, 2022
1 parent 5be9684 commit 0aecffe
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bin/buildAll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ cp src/native/lib/libsass.so src/main/resources/linux-x86/libsass.so
./bin/docker/buildLinux/x86/dockcross make -C src/native/ clean

docker run --rm -v $(pwd)/bin/docker/buildLinux/x86-64/:/Compile -v $(pwd):/sass libsass/linux:1
docker run --rm -v $(pwd)/bin/docker/buildDarwin:/Compile -v $(pwd):/sass libsass/darwin:1
docker run --rm -v $(pwd)/bin/docker/buildDarwin-x86-64:/Compile -v $(pwd):/sass libsass/darwin-x86-64:1
1 change: 1 addition & 0 deletions bin/docker/buildDarwin-aarch64/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Needs something to compile libsaas on `arm64` arch.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
cd /sass

rm -r src/main/resources/darwin
rm -r src/main/resources/darwin-x86-64
mkdir -p src/main/resources/darwin
mkdir -p src/main/resources/darwin-x86-64

# *** Build libsass
make -C src/native clean
Expand All @@ -21,6 +23,7 @@ BUILD=shared \

# *** Copy to target location. Note that the makefile from libsass will output a .so file. Renaming it to .dylib is good enough.
cp src/native/lib/libsass.so src/main/resources/darwin/libsass.dylib || exit 1
cp src/native/lib/libsass.so src/main/resources/darwin-x86-64/libsass.dylib || exit 1

# *** Cleanup
cd /sass/src/native
Expand Down
8 changes: 5 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ javaOptions += "-Djna.nosys=true"
addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.4.4")

libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"net.java.dev.jna" % "jna" % "5.5.0"
"org.scalatest" %% "scalatest" % "3.2.11" % "test",
"org.scalatest" %% "scalatest-mustmatchers" % "3.2.11" % "test",
"org.scalatest" %% "scalatest-funspec" % "3.2.11" % "test",
"net.java.dev.jna" % "jna" % "5.10.0"
)

// Compiler settings
Expand All @@ -32,7 +34,7 @@ scalacOptions ++= Seq(
"-encoding",
"UTF-8"
)
javacOptions ++= Seq("-source", "1.7", "-target", "1.7", "-Xlint")
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint")

// Bintray settings
bintrayOrganization in bintray := None
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.10
sbt.version=1.6.2
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.1")

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.3")

addCompilerPlugin("org.psywerx.hairyfotr" %% "linter" % "0.1.17")
Binary file added src/main/resources/darwin-aarch64/libsass.dylib
Binary file not shown.
Binary file added src/main/resources/darwin-x86-64/libsass.dylib
Binary file not shown.
5 changes: 3 additions & 2 deletions src/test/scala/org/irundaia/sass/SassCompilerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ package org.irundaia.sass

import java.nio.file.{Paths, Files}

import org.scalatest.{FunSpec, MustMatchers}
import org.scalatest.funspec.AnyFunSpec;
import org.scalatest.matchers.must._;

import scala.io.Source

class SassCompilerTest extends FunSpec with MustMatchers {
class SassCompilerTest extends AnyFunSpec with Matchers {
val testDir = Files.createTempDirectory("sbt-sassify")
val compilerSettings = CompilerSettings(Minified, true, true, Auto, Seq(), "", 10, "css")

Expand Down

0 comments on commit 0aecffe

Please sign in to comment.