forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request conan-io#121 from borune-k12/xkbcommon
add xkbcommon
- Loading branch information
Showing
10 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: xkbcommon CI | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'recipes/xkbcommon/all/**' | ||
- 'build.py' | ||
- '.github/workflows/xkbcommon.yml' | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'recipes/xkbcommon/all/**' | ||
- 'build.py' | ||
- '.github/workflows/xkbcommon.yml' | ||
|
||
env: | ||
CONAN_PASSWORD: ${{ secrets.BintrayApiKey }} | ||
CONAN_DOCKER_ENTRY_SCRIPT: sudo apt update && sudo apt install -y bison pkg-config | ||
IS_PURE_C: true | ||
|
||
jobs: | ||
xkbcommon: | ||
strategy: | ||
matrix: | ||
build: ['linux-gcc8', 'linux-gcc9'] | ||
xkbcommon_versions: ['0.10.0'] | ||
include: | ||
- build: 'linux-gcc8' | ||
os: 'ubuntu-latest' | ||
compiler: 'gcc' | ||
compiler_version: '8' | ||
docker_image: 'conanio/gcc8' | ||
build_types: 'Release,Debug' | ||
archs: 'x86_64' | ||
- build: 'linux-gcc9' | ||
os: 'ubuntu-latest' | ||
compiler: 'gcc' | ||
compiler_version: '9' | ||
docker_image: 'conanio/gcc9' | ||
build_types: 'Release,Debug' | ||
archs: 'x86_64' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Configure git | ||
run: git config --global core.autocrlf false | ||
shell: bash | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: sources | ||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- name: Build and Optionally Upload | ||
uses: trassir/run-cpt@v0.2.2-trassir | ||
with: | ||
install: custom | ||
# TODO: replace when https://github.com/conan-io/conan-package-tools/issues/479 will be fixed upstream | ||
custom-package: git+https://github.com/trassir/conan-package-tools@fix-479-trassir | ||
work-dir: sources/recipes/xkbcommon/all | ||
build-script: ../../../build.py | ||
compiler: ${{ matrix.compiler }} | ||
compiler-versions: ${{ matrix.compiler_version }} | ||
docker-images: ${{ matrix.docker_image }} | ||
env: | ||
CONAN_VISUAL_RUNTIMES: ${{ matrix.vs_runtimes }} | ||
CONAN_ARCHS: ${{ matrix.archs }} | ||
CONAN_BUILD_TYPES: ${{ matrix.build_types }} | ||
CONAN_REFERENCE: xkbcommon/${{ matrix.xkbcommon_versions }} | ||
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_subdirectory("source_subfolder") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2018 Bincrafters | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sources: | ||
"0.8.4": | ||
url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-0.8.4.tar.gz" | ||
sha256: "299b47558188017047354995f5882d43c2c8a60367df553319dcecebadb73e1d" | ||
"0.9.1": | ||
url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-0.9.1.tar.gz" | ||
sha256: "4d869ed841a27ca4a2e5ca41ca6bacc97f8f6b42b1aa6ae9ee29c6e9768e2f1a" | ||
"0.10.0": | ||
url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-0.10.0.tar.gz" | ||
sha256: "9b4635cf5d9fc0fb9611ceec1780aafc0944299e9a29ab09c18ec2633923b9c3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
from conans import ConanFile, Meson, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
import shutil | ||
|
||
|
||
class XkbcommonConan(ConanFile): | ||
name = "xkbcommon" | ||
description = "keymap handling library for toolkits and window systems" | ||
topics = ("conan", "xkbcommon", "keyboard") | ||
url = "https://github.com/bincrafters/conan-xkbcommon" | ||
homepage = "https://github.com/xkbcommon/libxkbcommon" | ||
license = "MIT" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"with_x11": [True, False], | ||
"with_wayland": [True, False], | ||
"docs": [True, False] | ||
} | ||
default_options = { | ||
"shared": True, | ||
"fPIC": True, | ||
"with_x11": True, | ||
"with_wayland": False, | ||
"docs": False, | ||
"libxcb:shared": True | ||
} | ||
_source_subfolder = "source_subfolder" | ||
_build_subfolder = "build_subfolder" | ||
|
||
def configure(self): | ||
if self.settings.os != "Linux": | ||
raise ConanInvalidConfiguration("This library is only compatible with Linux") | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
def build_requirements(self): | ||
# take meson from conan since we need version >= 0.47 for customizing installation | ||
# (i.e. set installation prefix) - https://mesonbuild.com/Installing.html | ||
# meson from official ubuntu repos now has version 0.45.1 | ||
if not tools.which("meson"): | ||
self.build_requires("meson/0.53.2") | ||
# take next dependencies from the system | ||
# if not tools.which("bison"): | ||
# self.build_requires("bison_installer/3.4.1) | ||
# if not tools.which("pkg-config"): | ||
# self.build_requires("pkg-config_installer/0.29.2") | ||
|
||
def requirements(self): | ||
self.requires("xkeyboard-config/2.28") | ||
if self.options.with_x11: | ||
self.requires("libxcb/1.13.1") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
extracted_dir = "libxkbcommon-" + self.name + "-" + self.version | ||
os.rename(extracted_dir, self._source_subfolder) | ||
|
||
def _configure_meson(self): | ||
meson = Meson(self) | ||
meson.configure( | ||
defs={ | ||
"enable-wayland": self.options.with_wayland, | ||
"enable-docs": self.options.docs, | ||
"enable-x11": self.options.with_x11, | ||
"libdir": os.path.join(self.package_folder, "lib"), | ||
"default_library": ("shared" if self.options.shared else "static") | ||
}, | ||
source_folder=self._source_subfolder, | ||
build_folder=self._build_subfolder) | ||
return meson | ||
|
||
def build(self): | ||
def _get_pc_files(package): | ||
if package in self.deps_cpp_info.deps: | ||
lib_path = self.deps_cpp_info[package].rootpath | ||
for dirpath, _, filenames in os.walk(lib_path): | ||
for filename in filenames: | ||
if filename.endswith('.pc'): | ||
shutil.copyfile(os.path.join(dirpath, filename), filename) | ||
tools.replace_prefix_in_pc_file(filename, lib_path) | ||
for dep in self.deps_cpp_info[package].public_deps: | ||
_get_pc_files(dep) | ||
_get_pc_files('libxcb') | ||
_get_pc_files('xkeyboard-config') | ||
meson = self._configure_meson() | ||
meson.build() | ||
|
||
def package(self): | ||
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) | ||
meson = self._configure_meson() | ||
meson.install() | ||
|
||
def package_info(self): | ||
self.env_info.destdir.append("../install") | ||
self.cpp_info.libs = tools.collect_libs(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(test_package) | ||
|
||
set(CMAKE_VERBOSE_MAKEFILE TRUE) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from conans import ConanFile, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "xkbcommon/xkbcommon.h" | ||
|
||
int main() | ||
{ | ||
struct xkb_context *ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS); | ||
if (!ctx) return 1; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
versions: | ||
"0.8.4": | ||
folder: all | ||
"0.9.1": | ||
folder: all | ||
"0.10.0": | ||
folder: all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/bincrafters/conan-xkbcommon/commit/74a93d52e4c6a1f8c38852d8498394e0c8f5d1cb |