Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Need help for writing ebuild for a c program

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
12 posts • Page 1 of 1
Author
Message
Lemon-Lime
n00b
n00b
User avatar
Posts: 59
Joined: Thu Apr 27, 2023 6:55 pm

Need help for writing ebuild for a c program

  • Quote

Post by Lemon-Lime » Sat Sep 02, 2023 2:23 am

I couldn't find much documentation on ebuilds for c programs, ironically enough. Said program has a functioning makefile (when run manually)

Are there any examples of ebuilds for SMALL c programs? Nothing TOO complicated.

Are there any e-classes I should know of? Thanks in advance!
Crazy frog is the artist, not the song
Top
grknight
Retired Dev
Retired Dev
Posts: 2560
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sat Sep 02, 2023 2:38 am

This should work with the default functions without any eclasses. Just the basic variable definitions may be sufficient. Example from the wiki
If it is not, post the ebuild and build.log
Top
Lemon-Lime
n00b
n00b
User avatar
Posts: 59
Joined: Thu Apr 27, 2023 6:55 pm

  • Quote

Post by Lemon-Lime » Sat Sep 02, 2023 2:45 am

Hi grknight!
I just figured out what I was missing: The Install Functions.
I added a doins in the src_install phase and it seems to work.

Here's the reference if anyone else has a similar problem: https://devmanual.gentoo.org/function-r ... functions/

Thank you grknight for your quick response! :D
Crazy frog is the artist, not the song
Top
grknight
Retired Dev
Retired Dev
Posts: 2560
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sat Sep 02, 2023 3:06 am

Lemon-Lime wrote:Hi grknight!
I just figured out what I was missing: The Install Functions.
I added a doins in the src_install phase and it seems to work.

Here's the reference if anyone else has a similar problem: https://devmanual.gentoo.org/function-r ... functions/

Thank you grknight for your quick response! :D
This would only be necessary if 'make DESTDIR="${D}" install' were to fail or place the result in a strange place.

Also, consider doexe or dobin or dosbin instead of doins for a C executable. Or dolib.so for a shared library.
Top
logrusx
Advocate
Advocate
User avatar
Posts: 3530
Joined: Thu Feb 22, 2018 2:29 pm

  • Quote

Post by logrusx » Sat Sep 02, 2023 8:06 am

Share the ebuild if you want to get feedback.

Best Regards,
Georgi
Top
Lemon-Lime
n00b
n00b
User avatar
Posts: 59
Joined: Thu Apr 27, 2023 6:55 pm

  • Quote

Post by Lemon-Lime » Sat Sep 02, 2023 5:41 pm

logrusx wrote:Share the ebuild if you want to get feedback.

Best Regards,
Georgi
Here it is!
https://github.com/lima-limon-inc/lemon ... 2.2.ebuild
*1

It's for a program that inspects traffic between to endpoints.
Here's the source code (with the original makefile):
https://github.com/eldipa/tiburoncin

PS:
1* I removed a big chunk of the makefile that contained test stuff. I did it to have a minimal working ebuild thing fast. I think the correct usage would be to use USE flags

Thanks in advance!
Crazy frog is the artist, not the song
Top
logrusx
Advocate
Advocate
User avatar
Posts: 3530
Joined: Thu Feb 22, 2018 2:29 pm

  • Quote

Post by logrusx » Sun Sep 03, 2023 8:12 am

There are two approches. The one you've taken is to completely substituted the Makefile. You've done that with the definition of src_compile and src_install. A side effect is you don't need the Makefile anymore so the patch is pointless. Also make files are usually unstable so patching them is discouraged.

The second is to create a PR with the appropriate changes to the make file so that you don't need to do anything in the ebuild and let portage do its job.

Best Regards,
Georgi
Top
grknight
Retired Dev
Retired Dev
Posts: 2560
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sun Sep 03, 2023 1:42 pm

logrusx wrote:The one you've taken is to completely substituted the Makefile. You've done that with the definition of src_compile and src_install. A side effect is you don't need the Makefile anymore so the patch is pointless.
Defining src_compile here is using the Makefile with the emake command. One step to bypass the patch is just to put "compile" at the end of that command. Using the compile target will not run tests (at least in this particular Makefile).
Top
logrusx
Advocate
Advocate
User avatar
Posts: 3530
Joined: Thu Feb 22, 2018 2:29 pm

  • Quote

Post by logrusx » Sun Sep 03, 2023 6:46 pm

grknight wrote:
logrusx wrote:The one you've taken is to completely substituted the Makefile. You've done that with the definition of src_compile and src_install. A side effect is you don't need the Makefile anymore so the patch is pointless.
Defining src_compile here is using the Makefile with the emake command. One step to bypass the patch is just to put "compile" at the end of that command. Using the compile target will not run tests (at least in this particular Makefile).
I'm not sure where I must have been looking, only now I see it's in fact emake and not a copy of the command from the make file which impression I had :)

p.s. https://github.com/eldipa/tiburoncin/issues/4

Best Regards,
Georgi
Top
logrusx
Advocate
Advocate
User avatar
Posts: 3530
Joined: Thu Feb 22, 2018 2:29 pm

  • Quote

Post by logrusx » Mon Sep 04, 2023 2:59 pm

My PR is merged, for the next version you'll be able to use a bare bones ebuild without any phases predefined whatsoever.

Best Regards,
Georgi
Top
Lemon-Lime
n00b
n00b
User avatar
Posts: 59
Joined: Thu Apr 27, 2023 6:55 pm

  • Quote

Post by Lemon-Lime » Mon Sep 04, 2023 3:46 pm

logrusx wrote:My PR is merged, for the next version you'll be able to use a bare bones ebuild without any phases predefined whatsoever.

Best Regards,
Georgi
I saw that! Thank you so much logrusx! That was very kind of you.

Best Regards!
:D
Crazy frog is the artist, not the song
Top
logrusx
Advocate
Advocate
User avatar
Posts: 3530
Joined: Thu Feb 22, 2018 2:29 pm

  • Quote

Post by logrusx » Mon Sep 04, 2023 5:57 pm

Lemon-Lime wrote:
logrusx wrote:My PR is merged, for the next version you'll be able to use a bare bones ebuild without any phases predefined whatsoever.

Best Regards,
Georgi
I saw that! Thank you so much logrusx! That was very kind of you.

Best Regards!
:D
Gratitude goes to Gentoo developers, fellows who write the Wiki and folks in #gentoo-dev-help :)

Best Regards,
Georgi
Top
Post Reply

12 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic