You are not logged in.

#1 2008-10-08 15:11:56

MajorTom
Member
Registered: 2008-09-12
Posts: 58

Passing compile options in PKGBUILD honoured or overriden?

Hey there.

First post. New Arch user here, saying: hello! Been using Linux for years. Recently switched from a .DEB-based distro. Love the rolling release model and pacman and ABS (first time exposure to the latter - I don't even have it in my car!). Thanks for all the good stuff.
I figured a good way to start using Arch would be to contribute to the Wiki and to build a package or two. cool

In the PKGBUILD I submitted, I have:

make GCCOPTS="-DKERNEL2_1 -D_GNU_SOURCE -O3 -Wall" tleds || return 1

I included options like -O3 and -Wall verbatim from the Makefile of the original tarball. Do these get overridden by CFLAGS from /etc/makepkg.conf? (I pretty much left it untouched)
Is -D_GNU_SOURCE even necessary? (it seems to compile without it as well)

* Edit: changed subject.

Last edited by MajorTom (2008-10-10 15:10:24)

Offline

#2 2008-10-11 17:22:52

MajorTom
Member
Registered: 2008-09-12
Posts: 58

Re: Passing compile options in PKGBUILD honoured or overriden?

Kinda feels weird replying to my own post... am I asking a completely n00b question here or what?

In essence, I'm trying to find out if I pass "-O3" in PKGBUILD, is it going to override "-O2" set in /etc/makepkg.conf?
I'm assuming the answer is: yes.

Offline

#3 2008-10-11 22:15:35

creslin
Member
Registered: 2008-10-04
Posts: 241

Re: Passing compile options in PKGBUILD honoured or overriden?

I don't have a definitive answer for you, but I would export new compile flags before the build just to be sure.

build() {
  ...
  export CFLAGS="-DKERNEL2_1 -D_GNU_SOURCE -O3 -Wall"
  export CXXFLAGS="${CFLAGS}"
  ...
  make tleds || return 1
  ...
}

ARCH|awesome3.0 powered by Pentium M 750 | 512MB DDR2-533 | Radeon X300 M
The journey is the reward.

Offline

#4 2008-10-11 23:17:21

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Passing compile options in PKGBUILD honoured or overriden?

If these options are already in the Makefile, you don't have to pass them explicitly to make. After all, make reads the Makefile.

Offline

#5 2008-10-12 07:10:36

MajorTom
Member
Registered: 2008-09-12
Posts: 58

Re: Passing compile options in PKGBUILD honoured or overriden?

tomk wrote:

If these options are already in the Makefile, you don't have to pass them explicitly to make. After all, make reads the Makefile.

In this particular case, the default Makefile needs to be modified or else the app won't work with kernels 2.1.x and up. This is taken care of by the $GCCOPTS variable (defined by the app author in the Makefile) which will pass the "-DKERNEL2_1" compile option to 'make'.

What I'm unsure of is: the Makefile also specifies "-O3" while /etc/makepkg.conf defines "-O2". Which one wins? Should the PKGBUILD not include that option and in that case would 'make' use "-O2" from the makepkg.conf?
Moreover, the Makefile includes "-Wall". Can/should this be omited? Does it really matter?

Asking questions is the only way to learn. Thanks guys!

Offline

Board footer

Powered by FluxBB