Skip to content

Commit

Permalink
feature: add IIIF 3.0 support (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
subotic authored Jun 24, 2020
1 parent 9166503 commit d04725a
Show file tree
Hide file tree
Showing 45 changed files with 833 additions and 414 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: CI

on: [push]
on:
push:
release:
types: [published]

jobs:
test:
Expand All @@ -10,7 +13,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
fetch-depth: 50
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
Expand All @@ -19,16 +22,16 @@ jobs:
path: ci
- name: Copy ci-assets
run: |
cp $GITHUB_WORKSPACE/ci/kakadu/v8_0_3-01727L.zip $GITHUB_WORKSPACE/vendor/v8_0_3-01727L.zip
cp $GITHUB_WORKSPACE/ci/kakadu/v8_0_5-01727L.zip $GITHUB_WORKSPACE/vendor/v8_0_5-01727L.zip
- name: run compile and tests inside docker
run: make test-ci

# publish only for develop and tags
# publish only on release
publish:
name: Publish to Dockerhub
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')
if: github.even_name == 'release' || startsWith(github.ref, 'refs/tags')
steps:
- name: checkout source
uses: actions/checkout@v1
Expand All @@ -42,7 +45,7 @@ jobs:
path: ci
- name: copy ci-assets
run: |
cp $GITHUB_WORKSPACE/ci/kakadu/v8_0_2-01727L.zip $GITHUB_WORKSPACE/vendor/v8_0_2-01727L.zip
cp $GITHUB_WORKSPACE/ci/kakadu/v8_0_5-01727L.zip $GITHUB_WORKSPACE/vendor/v8_0_5-01727L.zip
- name: build and publish image
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
Expand Down
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
if(CMAKE_SYSTEM_NAME STREQUAL DARWIN)
message(STATUS "Compiling for Darwin...")
message(STATUS ${CMAKE_SYSTEM_NAME})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
SET(CMAKE_MACOSX_RPATH 1)
SET(KDU_MAKE "Makefile-MAC-x86-${BITS}-gcc")
SET(KDU_ARCH "Mac-x86-${BITS}-gcc")
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Determine this makefile's path.
# Be sure to place this BEFORE `include` directives, if any.
# THIS_FILE := $(lastword $(MAKEFILE_LIST))
THIS_FILE := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

include vars.mk

.PHONY: docs-build
docs-build: ## build docs into the local 'site' folder
mkdocs build
Expand All @@ -14,6 +22,15 @@ docs-publish: ## build and publish docs to Github Pages
docs-install-requirements: ## install requirements for documentation
pip3 install -r requirements.txt

.PHONY: build-sipi-image
build-sipi-image: ## build and publish Sipi Docker image locally
docker build -t $(SIPI_IMAGE) .
docker tag $(SIPI_IMAGE) $(REPO):latest

.PHONY: publish-sipi-image
publish-sipi-image: build-sipi-image ## publish Sipi Docker image to Docker-Hub
docker push $(REPO)

.PHONY: compile
compile: ## compile SIPI inside Docker
docker run -it --rm -v ${PWD}:/sipi dhlabbasel/sipi-base:18.04 /bin/sh -c "mkdir -p /sipi/build-linux && cd /sipi/build-linux && cmake .. && make"
Expand All @@ -23,11 +40,21 @@ test: ## compile and run tests inside Docker
@mkdir -p ${PWD}/images
docker run -it --rm -v ${PWD}:/sipi dhlabbasel/sipi-base:18.04 /bin/sh -c "mkdir -p /sipi/build-linux && cd /sipi/build-linux && cmake .. && make && ctest --verbose"

.PHONY: test-ci
test-ci: ## compile and run tests inside Docker
@mkdir -p ${PWD}/images
docker run --rm -v ${PWD}:/sipi dhlabbasel/sipi-base:18.04 /bin/sh -c "mkdir -p /sipi/build-linux && cd /sipi/build-linux && cmake .. && make && ctest --verbose"

.PHONY: run
run: ## run SIPI inside Docker (does not compile)
@mkdir -p ${PWD}/images
docker run -it --rm -v ${PWD}:/sipi --workdir "/sipi" --expose "1024" --expose "1025" -p 1024:1024 -p 1025:1025 dhlabbasel/sipi-base:18.04 /bin/sh -c "/sipi/build-linux/sipi --config=/sipi/config/sipi.config.lua"

.PHONY: cmdline
cmdline: ## run SIPI inside Docker (does not compile)
@mkdir -p ${PWD}/images
docker run -it --rm -v ${PWD}:/sipi --workdir "/sipi" --expose "1024" --expose "1025" -p 1024:1024 -p 1025:1025 dhlabbasel/sipi-base:18.04 /bin/sh

.PHONY: clean
clean: ## cleans the project directory
@rm -rf build-linux/
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/dhlab-basel/Sipi.svg?branch=develop)](https://travis-ci.org/dhlab-basel/Sipi)
[![Build Status](https://github.com/dasch-swiss/sipi/workflows/CI/badge.svg?branch=develop)](https://github.com/dasch-swiss/sipi/actions)

# Overview

Expand Down Expand Up @@ -26,16 +26,16 @@ Freely distributable binary releases will be available soon.

# Documentation

The manual is online at https://sipi.io.
The documentation is online at https://sipi.io.

To build it locally, you will need [Sphinx](http://www.sphinx-doc.org/en/stable/index.html).
In the `manual` subdirectory of the source tree, type:
To build it locally, you will need [MkDocs](https://www.mkdocs.org/).
In the root the source tree, type:

```
make html
make docs-build
```

You will then find the manual under `manual/_build/html`.
You will then find the manual under `site/index.html`.

# Building from source

Expand All @@ -56,7 +56,7 @@ $ (mkdir -p ./build-mac && cd build-mac && cmake .. && make && ctest --verbose)

# Releases

Releases are published on Dockerhub: https://cloud.docker.com/u/dhlabbasel/repository/docker/dhlabbasel/sipi
Releases are published on Dockerhub: https://hub.docker.com/repository/docker/daschswiss/sipi


# Contact Information
Expand Down
6 changes: 3 additions & 3 deletions ext/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ endif()
#
ExternalProject_Add(project_curl
INSTALL_DIR ${COMMON_LOCAL}
URL https://curl.haxx.se/download/curl-7.68.0.tar.gz
SOURCE_DIR ${COMMON_SRCS}/curl-7.68.0
CONFIGURE_COMMAND ${COMMON_SRCS}/curl-7.68.0/configure
URL https://curl.haxx.se/download/curl-7.70.0.tar.gz
SOURCE_DIR ${COMMON_SRCS}/curl-7.70.0
CONFIGURE_COMMAND ${COMMON_SRCS}/curl-7.70.0/configure
--prefix=${COMMON_LOCAL}
--enable-shared
--enable-static
Expand Down
4 changes: 2 additions & 2 deletions ext/fmt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ include(ExternalProject)
ExternalProject_Add(
project_fmt
INSTALL_DIR ${COMMON_LOCAL}
URL https://github.com/fmtlib/fmt/releases/download/6.1.2/fmt-6.1.2.zip
SOURCE_DIR ${COMMON_SRCS}/fmt-6.1.2
URL https://github.com/fmtlib/fmt/releases/download/6.2.1/fmt-6.2.1.zip
SOURCE_DIR ${COMMON_SRCS}/fmt-6.2.1
CMAKE_ARGS -DFMT_DOC=OFF -DCMAKE_PREFIX_PATH=${COMMON_LOCAL} -DCMAKE_INSTALL_PREFIX=${COMMON_LOCAL} -DCMAKE_INSTALL_LIBDIR=${CONFIGURE_LIBDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions ext/freetype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ ExternalProject_Add(project_freetype
DEPENDS bzip2
INSTALL_DIR ${COMMON_LOCAL}
#URL_HASH SHA256=c75e3c4a0811bf700d92c82319373b7a825a2331c12b8b37d41eb58e4f18eafb
URL https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz
SOURCE_DIR ${COMMON_SRCS}/freetype-2.10.1
URL https://download.savannah.gnu.org/releases/freetype/freetype-2.10.2.tar.gz
SOURCE_DIR ${COMMON_SRCS}/freetype-2.10.2
CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_INSTALL_PREFIX=${COMMON_LOCAL}
-DCMAKE_INSTALL_LIBDIR=${CONFIGURE_LIBDIR}
Expand Down
6 changes: 3 additions & 3 deletions ext/gettext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ include(ExternalProject)
ExternalProject_Add(
project_gettext
INSTALL_DIR ${COMMON_LOCAL}
URL http://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.1.tar.gz
SOURCE_DIR ${COMMON_SRCS}/gettext--0.20.1
CONFIGURE_COMMAND ${COMMON_SRCS}/gettext--0.20.1/configure
URL http://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.2.tar.gz
SOURCE_DIR ${COMMON_SRCS}/gettext--0.20.2
CONFIGURE_COMMAND ${COMMON_SRCS}/gettext--0.20.2/configure
--prefix=${COMMON_LOCAL}
--enable-static
--libdir=${CONFIGURE_LIBDIR}
Expand Down
4 changes: 2 additions & 2 deletions ext/harfbuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ExternalProject_Add(project_harfbuzz
DEPENDS freetype
DEPENDS bzip2
INSTALL_DIR ${COMMON_LOCAL}
URL https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.1.tar.xz
SOURCE_DIR ${COMMON_SRCS}/harfbuzz-2.6.1
URL https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.4.tar.xz
SOURCE_DIR ${COMMON_SRCS}/harfbuzz-2.6.4
CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_INSTALL_PREFIX=${COMMON_LOCAL}
-DCMAKE_INSTALL_LIBDIR=${CONFIGURE_LIBDIR}
Expand Down
2 changes: 1 addition & 1 deletion ext/jansson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ExternalProject_Add(
project_jansson
INSTALL_DIR ${COMMON_LOCAL}
# GIT_REPOSITORY https://github.com/akheron/jansson.git
URL http://www.digip.org/jansson/releases/jansson-2.12.tar.gz
URL http://www.digip.org/jansson/releases/jansson-2.13.1.tar.gz
SOURCE_DIR ${COMMON_SRCS}/jansson
CMAKE_ARGS -DCMAKE_PREFIX_PATH=${COMMON_LOCAL}
-DCMAKE_INSTALL_PREFIX=${COMMON_LOCAL}
Expand Down
15 changes: 6 additions & 9 deletions ext/kakadu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ include(ExternalProject)

message(STATUS ${CONFIGURE_LIBDIR})
#
# compiling kakadu
#
# Patch the makefile to skip comiling the Java interface – we don't need it...
# compiling kakadu (without JAVA interface)
#

ExternalProject_Add(
project_kakadu
INSTALL_DIR ${COMMON_LOCAL}
DOWNLOAD_COMMAND unzip -o -d ${COMMON_SRCS} ${COMMON_VENDOR}/v8_0_3-01727L.zip
PATCH_COMMAND patch -d ${COMMON_SRCS}/v8_0_3-01727L/managed/make -p0 < ${COMMON_PATCHES}/${KDU_MAKE}.patch
DOWNLOAD_COMMAND unzip -o -d ${COMMON_SRCS} ${COMMON_VENDOR}/v8_0_5-01727L.zip
CONFIGURE_COMMAND ""
BUILD_COMMAND make --directory=${COMMON_SRCS}/v8_0_3-01727L/make/ -f ${KDU_MAKE}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${COMMON_SRCS}/v8_0_3-01727L/lib/${KDU_ARCH} ${CONFIGURE_LIBDIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${COMMON_SRCS}/v8_0_3-01727L/bin/${KDU_ARCH} ${COMMON_LOCAL}/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory ${COMMON_SRCS}/v8_0_3-01727L/managed/all_includes ${COMMON_LOCAL}/include
BUILD_COMMAND make --directory=${COMMON_SRCS}/v8_0_5-01727L/make/ -f ${KDU_MAKE} all_but_jni
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${COMMON_SRCS}/v8_0_5-01727L/lib/${KDU_ARCH} ${CONFIGURE_LIBDIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${COMMON_SRCS}/v8_0_5-01727L/bin/${KDU_ARCH} ${COMMON_LOCAL}/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory ${COMMON_SRCS}/v8_0_5-01727L/managed/all_includes ${COMMON_LOCAL}/include
)

ExternalProject_Get_Property(project_kakadu install_dir)
Expand Down
6 changes: 3 additions & 3 deletions ext/luarocks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ include(ExternalProject)
ExternalProject_Add(project_luarocks
DEPENDS lua
INSTALL_DIR ${COMMON_LOCAL}
URL http://luarocks.github.io/luarocks/releases/luarocks-3.0.4.tar.gz
SOURCE_DIR ${COMMON_SRCS}/luarocks-3.0.4
CONFIGURE_COMMAND ${COMMON_SRCS}/luarocks-3.0.4/configure
URL http://luarocks.github.io/luarocks/releases/luarocks-3.3.1.tar.gz
SOURCE_DIR ${COMMON_SRCS}/luarocks-3.3.1
CONFIGURE_COMMAND ${COMMON_SRCS}/luarocks-3.3.1/configure
--prefix=${COMMON_LOCAL}
--with-lua-bin=${COMMON_LOCAL}/bin
--with-lua-include=${COMMON_LOCAL}/include
Expand Down
6 changes: 3 additions & 3 deletions ext/sqlite3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ include(ExternalProject)
#
ExternalProject_Add(project_sqlite3
INSTALL_DIR ${COMMON_LOCAL}
URL https://www.sqlite.org/2020/sqlite-autoconf-3310000.tar.gz
SOURCE_DIR ${COMMON_SRCS}/sqlite-autoconf-3310000
CONFIGURE_COMMAND ${COMMON_SRCS}/sqlite-autoconf-3310000/configure --enable-fts5 --prefix=${COMMON_LOCAL} --enable-shared --enable-static --libdir=${CONFIGURE_LIBDIR}
URL https://www.sqlite.org/2020/sqlite-autoconf-3320200.tar.gz
SOURCE_DIR ${COMMON_SRCS}/sqlite-autoconf-3320200
CONFIGURE_COMMAND ${COMMON_SRCS}/sqlite-autoconf-3320200/configure --enable-fts5 --prefix=${COMMON_LOCAL} --enable-shared --enable-static --libdir=${CONFIGURE_LIBDIR}
BUILD_COMMAND make CFLAGS=-DSQLITE_ENABLE_RTREE=1
BUILD_IN_SOURCE 1
)
Expand Down
6 changes: 3 additions & 3 deletions ext/xz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ include(ExternalProject)
#
ExternalProject_Add(project_xz
INSTALL_DIR ${COMMON_LOCAL}
URL https://tukaani.org/xz/xz-5.2.4.tar.gz
SOURCE_DIR ${COMMON_SRCS}/xz-5.2.4
CONFIGURE_COMMAND ${COMMON_SRCS}/xz-5.2.4/configure --prefix=${COMMON_LOCAL} --libdir=${CONFIGURE_LIBDIR}
URL https://tukaani.org/xz/xz-5.2.5.tar.gz
SOURCE_DIR ${COMMON_SRCS}/xz-5.2.5
CONFIGURE_COMMAND ${COMMON_SRCS}/xz-5.2.5/configure --prefix=${COMMON_LOCAL} --libdir=${CONFIGURE_LIBDIR}
BUILD_COMMAND make
BUILD_IN_SOURCE 1
)
Expand Down
28 changes: 25 additions & 3 deletions include/SipiCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace Sipi {
*/
typedef struct {
size_t img_w, img_h;
size_t tile_w, tile_h;
int clevels;
int numpages;
char canonical[256];
char origpath[256];
Expand All @@ -76,6 +78,8 @@ namespace Sipi {
*/
typedef struct _CacheRecord {
size_t img_w, img_h;
size_t tile_w, tile_h;
int clevels;
int numpages;
std::string origpath;
std::string cachepath;
Expand All @@ -95,6 +99,9 @@ namespace Sipi {
typedef struct {
size_t img_w;
size_t img_h;
size_t tile_w;
size_t tile_h;
int clevels;
int numpages;
#if defined(HAVE_ST_ATIMESPEC)
struct timespec mtime; //!< entry time into cache
Expand Down Expand Up @@ -196,8 +203,16 @@ namespace Sipi {
* \param[in] canonical_p Canonical IIIF URL
* \param[in] cachepath_p Path of the cache file
*/
void add(const std::string &origpath_p, const std::string &canonical_p, const std::string &cachepath_p,
size_t img_w_p, size_t img_h_p, int numpages_p = 0);
void add(
const std::string &origpath_p,
const std::string &canonical_p,
const std::string &cachepath_p,
size_t img_w_p,
size_t img_h_p,
size_t tile_w_p = 0,
size_t tile_h_p = 0,
int clevels_p = 0,
int numpages_p = 0);

/*!
* Remove one file from the cache
Expand Down Expand Up @@ -253,7 +268,14 @@ namespace Sipi {
* \param[out] img_w Width of original image in pixels
* \param[out] img_h Height of original image in pixels
*/
bool getSize(const std::string &origname_p, size_t &img_w, size_t &img_h, int &numpages);
bool getSize(
const std::string &origname_p,
size_t &img_w,
size_t &img_h,
size_t &tile_w,
size_t &tile_h,
int &clevels,
int &numpages);
};
}

Expand Down
Loading

0 comments on commit d04725a

Please sign in to comment.