www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dub package with C code

reply Sebastiaan Koppe <mail skoppe.eu> writes:
I have just created bindings for libxlsxwriter, an c library for 
creating excel files.

Used the htod tool to do most of the work, and only had to adjust 
some things - mainly because libxlsxwriter uses data structures 
written in macro's.

Right now I am making a dub package and I would like to aim for 
convenience for end-users (read: me).

Therefor I decided to include the compiled static library inside 
the package. I only use Linux 64-bit myself, but this is 
obviously limiting for other people.

The other option I had was to include the whole c code, depend on 
gcc or clang, and have dub  (somehow) first build libxlsxwriter. 
But that seemed a bit too much...

Another option would be to require end-users to build 
libxlsxwriter themselves.

What do you guys recommend?
Sep 23 2015
next sibling parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 24/09/15 2:43 PM, Sebastiaan Koppe wrote:
 I have just created bindings for libxlsxwriter, an c library for
 creating excel files.

 Used the htod tool to do most of the work, and only had to adjust some
 things - mainly because libxlsxwriter uses data structures written in
 macro's.

 Right now I am making a dub package and I would like to aim for
 convenience for end-users (read: me).

 Therefor I decided to include the compiled static library inside the
 package. I only use Linux 64-bit myself, but this is obviously limiting
 for other people.

 The other option I had was to include the whole c code, depend on gcc or
 clang, and have dub  (somehow) first build libxlsxwriter. But that
 seemed a bit too much...

 Another option would be to require end-users to build libxlsxwriter
 themselves.

 What do you guys recommend?
Is libxlsxwriter available in the systems package manager? If so, I would just link against that. Preferably the shared library. Let e.g. Windows users figure theirs out.
Sep 23 2015
parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki Cattermole 
wrote:
 Is libxlsxwriter available in the systems package manager?
Pacman says no.
 Let e.g. Windows users figure theirs out.
libxlsxwriter is not supported on windows. Which is kind-of funny.
Sep 23 2015
parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 24/09/15 5:51 PM, Sebastiaan Koppe wrote:
 On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki Cattermole wrote:
 Is libxlsxwriter available in the systems package manager?
Pacman says no.
 Let e.g. Windows users figure theirs out.
libxlsxwriter is not supported on windows. Which is kind-of funny.
I've taken a look at it. Why not just port it?
Sep 23 2015
parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Thursday, 24 September 2015 at 06:00:50 UTC, Rikki Cattermole 
wrote:
 On 24/09/15 5:51 PM, Sebastiaan Koppe wrote:
 On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki 
 Cattermole wrote:
 Is libxlsxwriter available in the systems package manager?
Pacman says no.
 Let e.g. Windows users figure theirs out.
libxlsxwriter is not supported on windows. Which is kind-of funny.
I've taken a look at it. Why not just port it?
Because I want to focus on the product I am building right now, not on side-projects.
Sep 23 2015
next sibling parent reply Edwin van Leeuwen <edder tkwsping.nl> writes:
On Thursday, 24 September 2015 at 06:21:02 UTC, Sebastiaan Koppe 
wrote:
 Because I want to focus on the product I am building right now, 
 not on side-projects.
You could try including the c source in your repo and add preBuildCommands to the dub config which builds the static library. Alternatively you could use reggea to build both.
Sep 24 2015
parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Thursday, 24 September 2015 at 08:35:40 UTC, Edwin van Leeuwen 
wrote:
 Alternatively you could use reggea to build both.
I want to use dub. Simply because of code.dlang.org. Or can reggae also pull packages from there?
 You could try including the c source in your repo and add 
 preBuildCommands to the dub config which builds the static 
 library.
preBuildCommands seems to be the way to go. Thank you all.
Sep 24 2015
parent reply Atila Neves <atila.neves gmail.com> writes:
On Thursday, 24 September 2015 at 11:38:08 UTC, Sebastiaan Koppe 
wrote:
 On Thursday, 24 September 2015 at 08:35:40 UTC, Edwin van 
 Leeuwen wrote:
 Alternatively you could use reggea to build both.
I want to use dub. Simply because of code.dlang.org. Or can reggae also pull packages from there?
Yes. Atila
Sep 24 2015
parent Sebastiaan Koppe <mail skoppe.eu> writes:
On Friday, 25 September 2015 at 01:36:11 UTC, Atila Neves wrote:
 On Thursday, 24 September 2015 at 11:38:08 UTC, Sebastiaan 
 Koppe wrote:
 Or can reggae also pull packages from there?
Yes.
That is nice. I look at reggae once or twice. It looked like a lot of bootstrapping vs. `dub init && dub build`. And to be honest, I couldn't make immediate sense of the api. Is there any small example that builds some d code (including pulling deps)?
Sep 24 2015
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 24 September 2015 at 06:21:02 UTC, Sebastiaan Koppe 
wrote:
 Because I want to focus on the product I am building right now, 
 not on side-projects.
We should write a C to D converter. We have htod but I'm talking the whole source of it. That might be useful for times like this. But I have other things to do too...
Sep 24 2015
parent Sebastiaan Koppe <mail skoppe.eu> writes:
On Thursday, 24 September 2015 at 12:55:12 UTC, Adam D. Ruppe 
wrote:
 On Thursday, 24 September 2015 at 06:21:02 UTC, Sebastiaan 
 Koppe wrote:
 Because I want to focus on the product I am building right 
 now, not on side-projects.
We should write a C to D converter. We have htod but I'm talking the whole source of it. That might be useful for times like this. But I have other things to do too...
It would be really cool to have that. But aren't there a lot of corner cases that require manual intervention? Having said that, htod has been invaluable. And if I decide to port it, ctod will be invaluable as well, even though it won't get it 100% right.
Sep 24 2015
prev sibling parent reply Laeeth Isharc <laeethnospam nospamlaeeth.com> writes:
On Thursday, 24 September 2015 at 02:43:20 UTC, Sebastiaan Koppe 
wrote:
 I have just created bindings for libxlsxwriter, an c library 
 for creating excel files.

 Used the htod tool to do most of the work, and only had to 
 adjust some things - mainly because libxlsxwriter uses data 
 structures written in macro's.

 Right now I am making a dub package and I would like to aim for 
 convenience for end-users (read: me).

 Therefor I decided to include the compiled static library 
 inside the package. I only use Linux 64-bit myself, but this is 
 obviously limiting for other people.

 The other option I had was to include the whole c code, depend 
 on gcc or clang, and have dub  (somehow) first build 
 libxlsxwriter. But that seemed a bit too much...

 Another option would be to require end-users to build 
 libxlsxwriter themselves.

 What do you guys recommend?
nice work! worth a little blog post on the experience so others can be inspired by and benefit from yours?
Sep 24 2015
next sibling parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Thursday, 24 September 2015 at 18:19:49 UTC, Laeeth Isharc 
wrote:
 nice work!
To be honest it took me 2 hours, starting from git clone
 worth a little blog post on the experience so others can be 
 inspired by and benefit from yours?
I would be happy to write something. Any particular blog platform? Or do I first have to roll out my own?
Sep 24 2015
parent reply Laeeth Isharc <Laeeth.nospam nospam-laeeth.com> writes:
On Friday, 25 September 2015 at 01:48:57 UTC, Sebastiaan Koppe 
wrote:
 On Thursday, 24 September 2015 at 18:19:49 UTC, Laeeth Isharc 
 wrote:
 nice work!
To be honest it took me 2 hours, starting from git clone
 worth a little blog post on the experience so others can be 
 inspired by and benefit from yours?
I would be happy to write something. Any particular blog platform? Or do I first have to roll out my own?
Great! I think it's clear more blog posts will be something that helps open up awareness to value of D. Little things cumulatively make a big difference, and you'll more than get back the effort invested one way and another over time. Blog platform - I guess nothing wrong with wordpress etc. I am between platforms right now. I just don't want to deal with wordpress any more, and haven't yet picked something I like better. Something like Nikola and dicebot's mood with an nginx proxy seems appealing. Mood is v nice but not quite mature / stable yet. I like idea of everything in D so it's easy to understand and extend as you wish.
Sep 24 2015
parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Friday, 25 September 2015 at 06:04:09 UTC, Laeeth Isharc wrote:
 Blog platform - I guess nothing wrong with wordpress etc.  I am 
 between platforms right now.  I just don't want to deal with 
 wordpress any more, and haven't yet picked something I like 
 better.  Something like Nikola and dicebot's mood with an nginx 
 proxy seems appealing.  Mood is v nice but not quite mature / 
 stable yet.  I like idea of everything in D so it's easy to 
 understand and extend as you wish.
I meant if there is already a place where I can upload my post to. Something like blog.dlang.org I might go with mood. But I would probably dockerize it and run it behind jwilder/nginx-proxy.
Sep 24 2015
parent reply tired_eyes <pastuhov85 gmail.com> writes:
 I meant if there is already a place where I can upload my post 
 to. Something like blog.dlang.org
OT: Once again, I'm absolutely sure tha D should have an official blog! Forums can't replace blogs, forums are for discussions, not for content presentation.
Sep 25 2015
next sibling parent reply bachmeier <no spam.com> writes:
On Friday, 25 September 2015 at 12:25:52 UTC, tired_eyes wrote:
 I meant if there is already a place where I can upload my post 
 to. Something like blog.dlang.org
OT: Once again, I'm absolutely sure tha D should have an official blog! Forums can't replace blogs, forums are for discussions, not for content presentation.
I've long agreed with that. Now that we have "This Week in D" we have a regular source for content.
Sep 25 2015
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 25 September 2015 at 14:15:20 UTC, bachmeier wrote:
 On Friday, 25 September 2015 at 12:25:52 UTC, tired_eyes wrote:
 Once again, I'm absolutely sure tha D should have an official 
 blog! Forums can't replace blogs, forums are for discussions, 
 not for content presentation.
I've long agreed with that. Now that we have "This Week in D" we have a regular source for content.
FYI, if you guys want to set something up for multiple contributors like a traditional blog, I'm willing to move TWID do it. I've been kinda wanting to do a blog thing but I just haven't brought myself to set anything up.
Sep 25 2015
parent reply bachmeier <no spam.com> writes:
On Friday, 25 September 2015 at 14:24:36 UTC, Adam D. Ruppe wrote:

 FYI, if you guys want to set something up for multiple 
 contributors like a traditional blog, I'm willing to move TWID 
 do it.

 I've been kinda wanting to do a blog thing but I just haven't 
 brought myself to set anything up.
That's a possibility too, but I like the idea of you continuing to do what you've been doing, and then on the blog there is an announcement of the new issue of TWID along with a short discussion and a link to the whole thing. d.announce is pretty busy these days. I've always felt those posts were more appropriate for an official blog. As would things like the subject of this thread, rather than letting it get buried in the forum. First issue would be getting approval from Walter and Andrei. Second would be finding someone that knows how to do it.
Sep 25 2015
parent reply bachmeier <no spam.com> writes:
On Friday, 25 September 2015 at 15:06:41 UTC, bachmeier wrote:

 First issue would be getting approval from Walter and Andrei. 
 Second would be finding someone that knows how to do it.
Should I create a new thread to open discussion on the topic?
Sep 25 2015
parent Laeeth Isharc <spamnolaeeth nospamlaeeth.com> writes:
On Friday, 25 September 2015 at 15:08:00 UTC, bachmeier wrote:
 On Friday, 25 September 2015 at 15:06:41 UTC, bachmeier wrote:

 First issue would be getting approval from Walter and Andrei. 
 Second would be finding someone that knows how to do it.
Should I create a new thread to open discussion on the topic?
yes!
Sep 25 2015
prev sibling next sibling parent Laeeth Isharc <spamnolaeeth nospamlaeeth.com> writes:
On Friday, 25 September 2015 at 12:25:52 UTC, tired_eyes wrote:
 I meant if there is already a place where I can upload my post 
 to. Something like blog.dlang.org
OT: Once again, I'm absolutely sure tha D should have an official blog! Forums can't replace blogs, forums are for discussions, not for content presentation.
+1 It also encourages people to write guest pieces, because you know the work is not wasted as it reaches a broader audience. Also, as regards existing D blogs - Planet D was a great start but is a little bit tired. Some blogs are now defunct and haven't been updated for years. It would be great to still have a link to them, but they shouldn't be all mixed up - current and stale.
Sep 25 2015
prev sibling parent Andre Polykanine via Digitalmars-d-learn writes:
Hello tired_eyes,

tevDdl> Once again, I'm absolutely sure tha D should have an official
tevDdl> blog! Forums can't replace blogs, forums are for discussions, not 
tevDdl> for content presentation.

+1 on this.

-- 
With best regards from Ukraine,
Andre
Sep 25 2015
prev sibling parent bachmeier <no spam.net> writes:
On Thursday, 24 September 2015 at 18:19:49 UTC, Laeeth Isharc 
wrote:
 On Thursday, 24 September 2015 at 02:43:20 UTC, Sebastiaan 
 Koppe wrote:
 I have just created bindings for libxlsxwriter, an c library 
 for creating excel files.

 Used the htod tool to do most of the work, and only had to 
 adjust some things - mainly because libxlsxwriter uses data 
 structures written in macro's.

 Right now I am making a dub package and I would like to aim 
 for convenience for end-users (read: me).

 Therefor I decided to include the compiled static library 
 inside the package. I only use Linux 64-bit myself, but this 
 is obviously limiting for other people.

 The other option I had was to include the whole c code, depend 
 on gcc or clang, and have dub  (somehow) first build 
 libxlsxwriter. But that seemed a bit too much...

 Another option would be to require end-users to build 
 libxlsxwriter themselves.

 What do you guys recommend?
nice work! worth a little blog post on the experience so others can be inspired by and benefit from yours?
It seems this would be good content for the wiki. If we put this sort of thing there, others will start to look at the wiki, and Google will send them there. That wouldn't prevent anyone from also posting the same content on their own blog.
Sep 25 2015