-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[librdata] Add new recipe library #26024
base: master
Are you sure you want to change the base?
Conversation
29ad044
to
bd661b3
Compare
bd661b3
to
cd5a1c4
Compare
recipes/librdata/all/conanfile.py
Outdated
name = "librdata" | ||
version = "0.1" | ||
description = "librdata is a library for read and write R data frames from C" | ||
license = "CDDL-1.0", "LGPL-2.1-only" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not mandatory, but use a single expression with an AND or OR clause for the licenses, if possible, for clarity.
self.requires("zlib/1.2.13") | ||
self.requires("xz_utils/5.6.3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use version ranges for these - see the CCI docs for details.
recipes/librdata/all/conanfile.py
Outdated
git = Git(self) | ||
git.clone(url="https://github.com/WizardMac/librdata.git", target=".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not allowed on CCI - the sources used by the recipe must be immutable. Use a source archive from a tagged release or a source archive from a specific commit instead. I recommend taking a look at the recipe templates under docs/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This upstream repo is not has any release and tag for version control but can I just use HEAD.zip
from repo?
Thanks for your review.
recipes/librdata/all/conanfile.py
Outdated
env = VirtualBuildEnv(self) | ||
env.generate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed with Conan v2.
recipes/librdata/all/conanfile.py
Outdated
tc = AutotoolsToolchain(self) | ||
tc.generate() | ||
tc = AutotoolsDeps(self) | ||
if self.options.with_zip: | ||
tc.variables["with_zip"] = True | ||
tc.generate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is broken. You will have to pass the configure flag via AutotoolsToolchain.
recipes/librdata/all/conanfile.py
Outdated
fix_apple_shared_install_name(self) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("pkg_config_name", "readstat") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the .pc name of the library really that different from the project/recipe name?
printf("Read table: %s\n", name); | ||
|
||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably add a main() function for this to be a proper executable test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes.
91998e2
to
f37758c
Compare
f37758c
to
0774bd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shun2wang Thank you for your PR! I see librdata is packaged by Ubuntu and Debian as well!
In case you PR is still in WIP, please, move it to draft.
Please, take a look in my review!
"0.1": | ||
url: "https://github.com/WizardMac/librdata/archive/refs/heads/master.zip" | ||
sha256: "0f3eb4a386b9dbf9bdebba424061f7e34a0e1ec27fa4e631257c3be6ca450c57" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"0.1": | |
url: "https://github.com/WizardMac/librdata/archive/refs/heads/master.zip" | |
sha256: "0f3eb4a386b9dbf9bdebba424061f7e34a0e1ec27fa4e631257c3be6ca450c57" | |
"0.0.0.cci.20231003": | |
url: "https://github.com/WizardMac/librdata/archive/33bd276ecb0bbcd8997ccc71a544149b3da0d940.tar.gz" | |
sha256: "fc3e0d655c21d4b5144a0ad73f79a249903b5dde4dc8f7091cd0393d214294a2" |
Please, read https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#what-version-should-packages-use-for-libraries-without-official-releases for extra info
# git = Git(self) | ||
# git.clone(url="https://github.com/WizardMac/librdata.git", target=".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# git = Git(self) | |
# git.clone(url="https://github.com/WizardMac/librdata.git", target=".") |
Git feature is not used in CCI. Instead, download specific tar/zip file from the upstream.
"with_zip": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"with_zip": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"with_zip": [True, False], | |
} | |
default_options = { | |
"shared": False, | |
"fPIC": True, | |
"with_zip": False, | |
} | |
default_options = { | |
"shared": False, | |
"fPIC": True, |
I would suggest not adding an option for dependencies. The upstream does not expose an option as well when running configure script. I would suggest including all dependencies by default.
if self.options.with_zip: | ||
self.requires("bzip2/1.0.8") | ||
self.requires("zlib/1.2.13") | ||
self.requires("xz_utils/5.6.3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.options.with_zip: | |
self.requires("bzip2/1.0.8") | |
self.requires("zlib/1.2.13") | |
self.requires("xz_utils/5.6.3") | |
self.requires("bzip2/1.0.8") | |
self.requires("zlib/[>=1.2.11 <2]") | |
self.requires("xz_utils/[>=5.4.5 <6]") |
Please, read https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges for further information about allowed range versions in CCI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im sure it should only required when with_zip
.
@@ -0,0 +1,3 @@ | |||
versions: | |||
"0.1": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"0.1": | |
"0.0.0.cci.20231003": |
int main(int argc, char const *argv[]) | ||
{ | ||
rdata_parser_t *parser = rdata_parser_init(); | ||
if (parser == NULL) { | ||
fprintf(stderr, "Failed to initialize rdata_parser.\n"); | ||
return 1; | ||
} | ||
|
||
rdata_parser_free(parser); | ||
printf("librdata is successfully included, linked, and used.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int main(int argc, char const *argv[]) | |
{ | |
rdata_parser_t *parser = rdata_parser_init(); | |
if (parser == NULL) { | |
fprintf(stderr, "Failed to initialize rdata_parser.\n"); | |
return 1; | |
} | |
rdata_parser_free(parser); | |
printf("librdata is successfully included, linked, and used.\n"); | |
int main() | |
{ | |
rdata_parser_t *parser = rdata_parser_init(); | |
rdata_parser_free(parser); |
It does not need to check the method. The idea is checking only linkage and headers.
|
||
def package_info(self): | ||
suffix = "_i" if is_msvc(self) and self.options.shared else "" | ||
self.cpp_info.libs = [f"librdata{suffix}"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.cpp_info.libs = [f"librdata{suffix}"] | |
self.cpp_info.libs = [f"rdata{suffix}"] |
The prefix lib
should not part of the library name, as it's a standard based on the platform, not the library names itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the library does named as librdata
...
|
||
def package(self): | ||
copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
if is_msvc(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you really tested on Windows? Usually, it requires more when talking about autotools. In case you did not and has no intention, the recipe still can be accepted in CCI, just need more information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comment!
I really just want to build it for MacOS and Windows instead of Linux, but even so far I haven't found a suitable way to successfully build on Windows. Always fails at the config stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could take a look during the week for windows support. Right now, I don't have access to windows machine, but I'll have by tomorrow. You can take a look in gettext recipe as example: https://github.com/conan-io/conan-center-index/blob/master/recipes/libgettext/all/conanfile.py
|
||
class Libreadstat(ConanFile): | ||
name = "librdata" | ||
version = "0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = "0.1" |
Version should not be listed in the conan recipe
@shun2wang I was able to built librdata using MSYS2 on Windows: librdata-0.0.0-windows-msys.log The upstream uses MinGW in their CI: https://github.com/WizardMac/librdata/blob/master/.github/workflows/build.yml#L45 There is no mention about MSVC support, even in the issues. I would suggest not supporting MSVC for now, as it's not working and the there is no official support about. The msys can be supported, you just need to follow the Autotools template or gettext recipe as example. The ConanCenterIndex CI does not run MSYS, but you still can post a full build log in the comments like I did, the prove that's working. |
Summary
Add recipe: librdata
Motivation
Add new recipe of librdata
Details