Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package updates #13

Merged
merged 5 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions recipes/fontforge/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def requirements(self):
if self.settings.os == "Android" and int(self.settings.os.get_safe("api_level")) < 23:
self.requires("openlibm/0.8.3")

if self.settings.os == "Android":
self.requires("tmpfile/3.0.6")

def build_requirements(self):
self.tool_requires("gettext/0.22.5")

Expand Down
1 change: 1 addition & 0 deletions recipes/pdf2htmlex/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def requirements(self):
"with_cairo": True,
"with_glib": True,
"shared": False,
"fontconfiguration": "fontconfig",
})
self.requires("cairo/1.18.0-odr", options={
# Don't pull in xorg dependencies.
Expand Down
Binary file not shown.
25 changes: 21 additions & 4 deletions recipes/pdf2htmlex/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
Expand Down Expand Up @@ -26,7 +27,23 @@ def test(self):
self.run(bin_path, env="conanrun")

elif self.settings.os == "Android":
uploaded_bin_path = "/data/local/tmp/test_package"
if self.run("adb push {} {}".format(bin_path, uploaded_bin_path), env="conanrun", ignore_errors=True) == 0:
self.run("adb shell {}".format(uploaded_bin_path), env="conanrun")
self.run("adb shell rm {}".format(uploaded_bin_path), env="conanrun")
uploaded_dir = "/data/local/tmp/pdf2htmlex-test"

if self.run(f"adb shell mkdir {uploaded_dir}", env="conanrun", ignore_errors=True) == 0:
self.run(f"adb push {bin_path} {uploaded_dir}/link_test", env="conanrun")
self.run(f"adb shell {uploaded_dir}/link_test", env="conanrun")

self.run(f"adb push {self.dependencies['pdf2htmlex'].cpp_info.bindirs[0]}/pdf2htmlEX {uploaded_dir}", env="conanrun")
self.run(f"adb push {self.dependencies['pdf2htmlex'].cpp_info.resdirs[0]} {uploaded_dir}/pdf2htmlex-data", env="conanrun")
self.run(f"adb push {self.dependencies['poppler-data'].cpp_info.resdirs[0]} {uploaded_dir}/poppler-data", env="conanrun")
self.run(f"adb push {self.dependencies['fontconfig'].cpp_info.resdirs[0]} {uploaded_dir}/fontconfig", env="conanrun")
self.run(f"adb push {Path(Path(__file__).resolve().parent, "basic_text.pdf")} {uploaded_dir}/basic_text.pdf", env="conanrun")
self.run(f"adb shell \""
f"export FONTCONFIG_PATH={uploaded_dir}/fontconfig; "
f"cd {uploaded_dir}; "
f"./pdf2htmlEX basic_text.pdf basic_text.html "
f"--data-dir {uploaded_dir}/pdf2htmlex-data "
f"--poppler-data-dir {uploaded_dir}/poppler-data "
f"\"")

self.run(f"adb shell rm -r {uploaded_dir}", env="conanrun")
6 changes: 2 additions & 4 deletions recipes/poppler-data/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ def export_sources(self):

def package_id(self):
self.info.settings.clear()
self.info.clear()

def layout(self):
cmake_layout(self)

def package_id(self):
self.info.clear()

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)
tc.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down
13 changes: 9 additions & 4 deletions recipes/poppler-data/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import os.path

from conan import ConanFile


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
test_type = "explicit"

def build_requirements(self):
self.tool_requires(self.tested_reference_str)
def requirements(self):
self.requires(self.tested_reference_str)

def test(self):
# @TODO: actually test
yield
resdir = self.dependencies['poppler-data'].cpp_info.resdirs[0]
for i in ["cMap", "cidToUnicode", "nameToUnicode", "unicodeMap"]:
d = os.path.join(resdir, i)
assert os.path.exists(d)
assert len(os.listdir(d)) != 0
1 change: 0 additions & 1 deletion recipes/poppler-data/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
versions:
"0.4.12-odr":
folder: all

4 changes: 4 additions & 0 deletions recipes/poppler/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ def _patch_sources(self):
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"find_package(${_package_name} ${_package_version})", "find_package(${_package_name})")

replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"if(FONTCONFIG_FOUND)",
"if(WITH_FONTCONFIGURATION_FONTCONFIG)")

def build(self):
cmake = CMake(self)
cmake.configure()
Expand Down
4 changes: 4 additions & 0 deletions recipes/tmpfile/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"3.0.6":
url: "https://github.com/ViliusSutkus89/tmpfile-Android/archive/refs/tags/v3.0.6.tar.gz"
sha256: "e71dc8fabad2b36954188474d7b8760b2f34e311534d76428156cea3049ea4e3"
68 changes: 68 additions & 0 deletions recipes/tmpfile/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conans.errors import ConanInvalidConfiguration

required_conan_version = ">=2.0.6"


class TmpfileConan(ConanFile):
name = "tmpfile"
package_type = "library"

license = ["GPLv3"]
homepage = "https://github.com/ViliusSutkus89/tmpfile-Android/"
url = "https://github.com/opendocument-app/conan-odr-index"
description = "tmpfile POSIX function fix for Android"
topics = ("android", "posix", "workaround", "tmpfile", "bionic")

# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

def export_sources(self):
export_conandata_patches(self)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def validate(self):
if self.settings.os != "Android":
raise ConanInvalidConfiguration("Only Android is supported")

def layout(self):
cmake_layout(self)

def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.variables["WITH_JNI"] = "OFF"
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure(build_script_folder='tmpfile/src/main/cpp')
cmake.build()

def package(self):
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["tmpfile"]
self.cpp_info.includedirs = None
self.cpp_info.bindirs = None
9 changes: 9 additions & 0 deletions recipes/tmpfile/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.15)
project(tmpfile_tests CXX)

find_package(tmpfile CONFIG REQUIRED)

find_library(log-lib log)

add_executable(${PROJECT_NAME} libTests.exe.cpp)
target_link_libraries(${PROJECT_NAME} ${log-lib} tmpfile::tmpfile ${log-lib})
36 changes: 36 additions & 0 deletions recipes/tmpfile/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout


class FontForgeTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if self.settings.os == "Android":
bin_path = os.path.join(self.cpp.build.bindir, "tmpfile_tests")
uploaded_dir = "/data/local/tmp/tmpfile-test"

if self.run(f"adb shell mkdir {uploaded_dir}", env="conanrun", ignore_errors=True) == 0:
self.run(f"adb push {bin_path} {uploaded_dir}/tmpfile_tests", env="conanrun")

# Testcases described in
# https://github.com/ViliusSutkus89/tmpfile-Android/blob/v3.0.6/tests/src/androidTest/java/com/viliussutkus89/android/tmpfile/tests/StandaloneEXEInstrumentedTests.java
for i in range(1, 7):
print(f"Running testcase {i}")
self.run(f"adb shell {uploaded_dir}/tmpfile_tests {i}", env="conanrun")

self.run(f"adb shell rm -r {uploaded_dir}", env="conanrun")
Loading
Loading