[DO-1345] fixed windows packages (!16)
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/16 Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.team> Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.team>
This commit is contained in:
committed by
Aleksandr Vodyanov
parent
3759e1163f
commit
a82e89a1bc
22
recipes/strawberryperl/all/conandata.yml
Normal file
22
recipes/strawberryperl/all/conandata.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
sources:
|
||||
"5.32.1.1":
|
||||
x86:
|
||||
url: "https://nexus.avroid.tech/repository/strawberryperl_com/download/5.32.1.1/strawberry-perl-5.32.1.1-32bit-portable.zip"
|
||||
sha256: "d9c5711d12573a0f6d977792caa58364b1d46217521ae5c25cf5cc378a7c23c0"
|
||||
x86_64:
|
||||
url: "https://nexus.avroid.tech/repository/strawberryperl_com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit-portable.zip"
|
||||
sha256: "692646105b0f5e058198a852dc52a48f1cebcaf676d63bbdeae12f4eaee9bf5c"
|
||||
"5.30.0.1":
|
||||
x86:
|
||||
url: "https://nexus.avroid.tech/repository/strawberryperl_com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit-portable.zip"
|
||||
sha256: "a1d77821c77b7a3298cf3fe381e57cba43f89b9859204398f36d85f33b287837"
|
||||
x86_64:
|
||||
url: "https://nexus.avroid.tech/repository/strawberryperl_com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit-portable.zip"
|
||||
sha256: "9367a64ac1451b21804a224bb6235fe6848dd42f5fa1871583821ac3dfabf013"
|
||||
"5.28.1.1":
|
||||
x86:
|
||||
url: "https://nexus.avroid.tech/repository/strawberryperl_com/download/5.28.1.1/strawberry-perl-5.28.1.1-32bit-portable.zip"
|
||||
sha256: "8b15c7c9574989568254a7859e473b7d5f68a1145d2e4418036600a81b13805c"
|
||||
x86_64:
|
||||
url: "https://nexus.avroid.tech/repository/strawberryperl_com/download/5.28.1.1/strawberry-perl-5.28.1.1-64bit-portable.zip"
|
||||
sha256: "935c95ba096fa11c4e1b5188732e3832d330a2a79e9882ab7ba8460ddbca810d"
|
||||
57
recipes/strawberryperl/all/conanfile.py
Normal file
57
recipes/strawberryperl/all/conanfile.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from conan import ConanFile, conan_version
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.files import copy, get, rmdir
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.52.0"
|
||||
|
||||
|
||||
class StrawberryPerlConan(ConanFile):
|
||||
name = "strawberryperl"
|
||||
description = "Strawberry Perl for Windows."
|
||||
license = ("Artistic-1.0", "GPL-1.0")
|
||||
homepage = "http://strawberryperl.com"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
topics = ("perl", "interpreter", "windows")
|
||||
package_type = "application"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
|
||||
def layout(self):
|
||||
self.folders.build = "build"
|
||||
|
||||
def package_id(self):
|
||||
del self.info.settings.compiler
|
||||
del self.info.settings.build_type
|
||||
|
||||
def validate(self):
|
||||
if self.settings.os != "Windows":
|
||||
raise ConanInvalidConfiguration(f"{self.ref} is only intended to be used on Windows.")
|
||||
if self.settings.arch not in ("x86", "x86_64"):
|
||||
raise ConanInvalidConfiguration(f"{self.ref} is only available for x86 and x86_64 architectures.")
|
||||
|
||||
def source(self):
|
||||
pass
|
||||
|
||||
def build(self):
|
||||
get(self, **self.conan_data["sources"][self.version][str(self.settings.arch)], destination=self.build_folder)
|
||||
|
||||
def package(self):
|
||||
copy(self, pattern="License.rtf*", src=os.path.join(self.build_folder, "licenses"), dst=os.path.join(self.package_folder, "licenses"))
|
||||
copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "bin"), dst=os.path.join(self.package_folder, "bin"))
|
||||
copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "lib"), dst=os.path.join(self.package_folder, "lib"))
|
||||
copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "vendor", "lib"), dst=os.path.join(self.package_folder, "lib"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libdirs = []
|
||||
self.cpp_info.includedirs = []
|
||||
|
||||
perl_path = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/")
|
||||
self.conf_info.define("user.strawberryperl:perl", perl_path)
|
||||
|
||||
# TODO remove once conan v2 is the only support and recipes have been migrated
|
||||
if Version(conan_version).major < 2:
|
||||
bin_path = os.path.join(self.package_folder, "bin")
|
||||
self.env_info.PATH.append(bin_path)
|
||||
self.user_info.perl = perl_path
|
||||
16
recipes/strawberryperl/all/test_package/conanfile.py
Normal file
16
recipes/strawberryperl/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from conan import ConanFile
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "VirtualBuildEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires(self.tested_reference_str)
|
||||
|
||||
def test(self):
|
||||
self.run("perl --version")
|
||||
perl_script = os.path.join(self.source_folder, "list_files.pl")
|
||||
self.run(f"perl {perl_script}")
|
||||
12
recipes/strawberryperl/all/test_package/list_files.pl
Normal file
12
recipes/strawberryperl/all/test_package/list_files.pl
Normal file
@@ -0,0 +1,12 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Path::Tiny;
|
||||
|
||||
my $dir = path('.');
|
||||
my $iter = $dir->iterator;
|
||||
print "Hello Conan!\n";
|
||||
while (my $file = $iter->()) {
|
||||
next if $file->is_dir();
|
||||
print "$file\n";
|
||||
}
|
||||
Reference in New Issue
Block a user