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

[librdata] Add new recipe library #26024

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shun2wang
Copy link

@shun2wang shun2wang commented Nov 24, 2024

Summary

Add recipe: librdata

Motivation

Add new recipe of librdata

Details


@shun2wang shun2wang force-pushed the addLibrdata branch 5 times, most recently from 29ad044 to bd661b3 Compare November 25, 2024 03:58
@shun2wang shun2wang changed the title init add librdata library [WIP] init add librdata library Nov 25, 2024
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"
Copy link
Contributor

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.

Comment on lines +48 to +49
self.requires("zlib/1.2.13")
self.requires("xz_utils/5.6.3")
Copy link
Contributor

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.

Comment on lines 52 to 53
git = Git(self)
git.clone(url="https://github.com/WizardMac/librdata.git", target=".")
Copy link
Contributor

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/.

Copy link
Author

@shun2wang shun2wang Nov 25, 2024

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.

Comment on lines 56 to 57
env = VirtualBuildEnv(self)
env.generate()
Copy link
Contributor

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.

Comment on lines 58 to 63
tc = AutotoolsToolchain(self)
tc.generate()
tc = AutotoolsDeps(self)
if self.options.with_zip:
tc.variables["with_zip"] = True
tc.generate()
Copy link
Contributor

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.

fix_apple_shared_install_name(self)

def package_info(self):
self.cpp_info.set_property("pkg_config_name", "readstat")
Copy link
Contributor

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;
}
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes.

recipes/librdata/all/test_package/conanfile.py Outdated Show resolved Hide resolved
@uilianries uilianries self-assigned this Nov 26, 2024
Copy link
Member

@uilianries uilianries left a 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!

Comment on lines +2 to +4
"0.1":
url: "https://github.com/WizardMac/librdata/archive/refs/heads/master.zip"
sha256: "0f3eb4a386b9dbf9bdebba424061f7e34a0e1ec27fa4e631257c3be6ca450c57"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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

Comment on lines +52 to +53
# git = Git(self)
# git.clone(url="https://github.com/WizardMac/librdata.git", target=".")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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.

Comment on lines +26 to +31
"with_zip": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_zip": False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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.

Comment on lines +46 to +49
if self.options.with_zip:
self.requires("bzip2/1.0.8")
self.requires("zlib/1.2.13")
self.requires("xz_utils/5.6.3")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Author

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":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"0.1":
"0.0.0.cci.20231003":

Comment on lines +4 to +13
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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Author

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):
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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

@shun2wang shun2wang marked this pull request as draft November 26, 2024 09:49
@uilianries uilianries changed the title [WIP] init add librdata library [librdata] Add new recipe library Nov 26, 2024

class Libreadstat(ConanFile):
name = "librdata"
version = "0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.1"

Version should not be listed in the conan recipe

@uilianries
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants