Skip to content

Commit

Permalink
Upgrade to snappy-1.1.9 (#379)
Browse files Browse the repository at this point in the history
* Upgrade to snappy-1.1.9

* Add sbt-dynver

* Fix script so as not to requrie perl

* Upgrade bitshuffle to 0.5.1

* use bitshuffle 0.3.4, which can be compiled without errors

* Add native library build workflow
  • Loading branch information
xerial committed Jan 28, 2023
1 parent ef87735 commit a794389
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-native.yml
@@ -0,0 +1,36 @@
name: Build Native

on:
workflow_dispatch:

jobs:
build:
name: Build native libraries
runs-on: ubuntu-latest
steps:
- name: Build native libraries
run: make clean-native native-all
env:
OCI_EXE: docker
- name: Upload native libraries
uses: actions/upload-artifact@v3
with:
name: native-libs
path: src/main/resources/org/xerial/snappy/native/
push:
name: Push new native libraries to branch
runs-on: ubuntu-latest
needs: [check, build]
steps:
- uses: actions/checkout@v3
- name: Download native libraries
uses: actions/download-artifact@v3
with:
name: native-libs
path: src/main/resources/org/xerial/snappy/native/
- run: git status
- name: Commit and push
uses: EndBug/add-and-commit@v9
with:
message: 'Update native libraries'
default_author: github_actions
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -140,7 +140,7 @@ NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)

snappy-jar-version:=snappy-java-$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
snappy-jar-version:=snappy-java-$(shell cat version.sbt | cut -d'=' -f2 | sed 's/[ \"]//g')

native: jni-header snappy-header $(NATIVE_DLL)
native-nocmake: jni-header $(NATIVE_DLL)
Expand Down Expand Up @@ -175,7 +175,7 @@ mac32: jni-header
$(MAKE) native OS_NAME=Mac OS_ARCH=x86

mac64: jni-header
docker run -it $(DOCKER_RUN_OPTS) -v $$PWD:/workdir -e CROSS_TRIPLE=x86_64-apple-darwin xerial/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86_64
docker run -it $(DOCKER_RUN_OPTS) -v $$PWD:/workdir -e CROSS_TRIPLE=x86_64-apple-darwin multiarch/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86_64

linux32: jni-header
docker run $(DOCKER_RUN_OPTS) -ti -v $$PWD:/work xerial/centos5-linux-x86_64-pic bash -c 'make clean-native native-nocmake OS_NAME=Linux OS_ARCH=x86'
Expand Down
9 changes: 7 additions & 2 deletions Makefile.common
Expand Up @@ -26,7 +26,12 @@ OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch)
LIB_FOLDER := $(shell $(JAVA) -cp lib $(OSINFO_CLASS))
IBM_JDK_LIB := lib/inc_ibm

ENDIANESS=$(shell lscpu | grep "Byte Order" |cut -d ":" -f2)
ifeq ($(OS_NAME),Mac)
ENDIANESS:="Little Endian"
else
ENDIANESS:=$(shell lscpu | grep "Byte Order" |cut -d ":" -f2)
endif

# Windows uses different path separators
ifeq ($(OS_NAME),Windows)
sep := ;
Expand Down Expand Up @@ -218,7 +223,7 @@ Linux-armv6_SNAPPY_FLAGS:=
Linux-armv7_CXX := $(CROSS_PREFIX)g++
Linux-armv7_STRIP := $(CROSS_PREFIX)strip
Linux-armv7_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard -std=c++11
Linux-armv7_LINKFLAGS := -shared -static-libgcc
Linux-armv7_LINKFLAGS := -shared -static-libgcc
Linux-armv7_LIBNAME := libsnappyjava.so
Linux-armv7_SNAPPY_FLAGS:=

Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Expand Up @@ -3,3 +3,4 @@ addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.17")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
21 changes: 21 additions & 0 deletions script/dynver.sh
@@ -0,0 +1,21 @@
#!/bin/sh

# Compute sbt-dynver-compatible version number
BUILD_TIME=`date '+%Y%m%d-%H%M'`
DYN_VER=`git describe --long --tags --abbrev=8 --match "v[0-9]*" --always --dirty="-${BUILD_TIME}"`
GIT_DIST=`echo ${DYN_VER} | sed -re "s/v([^-]*)-([0-9]+)-g(.*)/\2/g"`
GIT_TAG=`git describe --tags --dirty`
RELEASE_VERSION=`echo ${DYN_VER} | sed -re "s/v([^-]*)-([0-9]+)-g(.*)/\1/g"`
SNAPSHOT_VERSION=`echo ${DYN_VER} | sed -re "s/v([^-]*)-([0-9]+)-g(.*)/\1-\2-\3/g"`-SNAPSHOT

if [ ${GIT_DIST} -eq 0 ]; then
if [ ${GIT_TAG} == *"-dirty" ]; then
VERSION=${SNAPSHOT_VERSION}
else
VERSION=${RELEASE_VERSION}
fi
else
VERSION=${SNAPSHOT_VERSION}
fi

echo ${VERSION}
4 changes: 2 additions & 2 deletions src/main/resources/org/xerial/snappy/VERSION
@@ -1,2 +1,2 @@
SNAPPY_VERSION=1.1.8
BITSHUFFLE_VERSION=0.3.2
SNAPPY_VERSION=1.1.9
BITSHUFFLE_VERSION=0.3.4
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion version.sbt
@@ -1 +1 @@
ThisBuild / version := "1.1.8.5-SNAPSHOT"
ThisBuild / version := "1.1.9.0-SNAPSHOT"

0 comments on commit a794389

Please sign in to comment.