forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
151 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,6 @@ | ||
sources: | ||
"1.2.4": | ||
url: | ||
- "https://www.x.org/archive/individual/lib/libSM-1.2.4.tar.xz" | ||
- "https://xorg.freedesktop.org/releases/individual/lib/libSM-1.2.4.tar.xz" | ||
sha256: "fdcbe51e4d1276b1183da77a8a4e74a137ca203e0bcfb20972dd5f3347e97b84" |
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,97 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.apple import fix_apple_shared_install_name | ||
from conan.tools.env import VirtualBuildEnv | ||
from conan.tools.files import copy, get, rm, rmdir | ||
from conan.tools.gnu import PkgConfigDeps, AutotoolsToolchain, Autotools | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.microsoft import is_msvc | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class LibSmConan(ConanFile): | ||
name = "libsm" | ||
description = "X11 Session Management library" | ||
license = "MIT AND MIT-open-group" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://gitlab.freedesktop.org/xorg/lib/libsm" | ||
topics = ("xorg", "x11") | ||
|
||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
} | ||
|
||
@property | ||
def _settings_build(self): | ||
return getattr(self, "settings_build", self.settings) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
self.settings.rm_safe("compiler.cppstd") | ||
self.settings.rm_safe("compiler.libcxx") | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("libice/1.1.1", transitive_headers=True) | ||
self.requires("xorg-proto/2024.1", transitive_headers=True) | ||
self.requires("xtrans/1.5.0") | ||
self.requires("util-linux-libuuid/2.39.2") | ||
|
||
def validate(self): | ||
if is_msvc(self): | ||
raise ConanInvalidConfiguration("MSVC is not supported.") | ||
|
||
def build_requirements(self): | ||
if not self.conf.get("tools.gnu:pkg_config", check_type=str): | ||
self.tool_requires("pkgconf/[>=2.2 <3]") | ||
if self._settings_build.os == "Windows": | ||
self.win_bash = True | ||
if not self.conf.get("tools.microsoft.bash:path", check_type=str): | ||
self.tool_requires("msys2/cci.latest") | ||
self.tool_requires("xorg-macros/1.20.0") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
VirtualBuildEnv(self).generate() | ||
tc = AutotoolsToolchain(self) | ||
tc.generate() | ||
deps = PkgConfigDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
autotools = Autotools(self) | ||
autotools.configure() | ||
autotools.make() | ||
|
||
def package(self): | ||
copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
autotools = Autotools(self) | ||
autotools.install() | ||
# rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
# rmdir(self, os.path.join(self.package_folder, "share")) | ||
rm(self, "*.la", os.path.join(self.package_folder, "lib")) | ||
fix_apple_shared_install_name(self) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("pkg_config_name", "sm") | ||
self.cpp_info.set_property("cmake_target_name", "X11::SM") | ||
self.cpp_info.libs = ["SM"] |
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,32 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.meson import Meson | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
basic_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build_requirements(self): | ||
self.tool_requires("meson/[>=1.2.3 <2]") | ||
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): | ||
self.tool_requires("pkgconf/[>=2.2 <3]") | ||
|
||
def build(self): | ||
meson = Meson(self) | ||
meson.configure() | ||
meson.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
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,5 @@ | ||
project('test_package', 'c') | ||
package_dep = dependency('sm') | ||
executable('test_package', | ||
sources : ['test_package.c'], | ||
dependencies : [package_dep]) |
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 <X11/SM/SMlib.h> | ||
|
||
#include <stdlib.h> | ||
|
||
int main() { | ||
SmProp *prop = malloc(sizeof(SmProp)); | ||
SmFreeProperty(prop); | ||
} |
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,3 @@ | ||
versions: | ||
"1.2.4": | ||
folder: all |