Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 282086 - app-arch/unzip-6.0-r1 requires -DNO_LCHMOD on IRIX
Summary: app-arch/unzip-6.0-r1 requires -DNO_LCHMOD on IRIX
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All IRIX
: High normal
Assignee: Gentoo Prefix
URL: http://sourceforge.net/tracker/?func=...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-20 11:10 UTC by Stuart Shelton
Modified: 2012-12-17 16:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
unzip-6.0-irix.patch (unzip.patch,1.07 KB, patch)
2009-08-20 11:10 UTC, Stuart Shelton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2009-08-20 11:10:01 UTC
--- unzip-6.0-r1.ebuild
+++ unzip-6.0-r1.ebuild
@@ -24,21 +24,7 @@ src_unpack() {
        unpack ${A}
        cd "${S}"
        epatch "${FILESDIR}"/${P}-no-exec-stack.patch
-       sed -i \
-               -e '/^CFLAGS/d' \
-               -e '/CFLAGS/s:-O[0-9]\?:$(CFLAGS) $(CPPFLAGS):' \
-               -e '/^STRIP/s:=.*:=true:' \
-               -e "s:CC=gcc :CC=$(tc-getCC) :" \
-               -e "s:LD=gcc :LD=$(tc-getCC) :" \
-               -e "s:AS=gcc :AS=$(tc-getCC) :" \
-               -e 's:LF2 = -s:LF2 = :' \
-               -e 's:LF = :LF = $(LDFLAGS) :' \
-               -e 's:SL = :SL = $(LDFLAGS) :' \
-               -e 's:FL = :FL = $(LDFLAGS) :' \
-               -e "/^#L_BZ2/s:^$(use bzip2 && echo .)::" \
-               -e 's:STRIP =.*$:STRIP = true:' \
-               unix/Makefile \
-               || die "sed unix/Makefile failed"
+       [[ ${CHOST} == *-irix* ]] && epatch "${FILESDIR}"/${P}-irix.patch
 }
 
 src_compile() {
@@ -59,11 +45,29 @@ src_compile() {
        esac
 
        [[ ${CHOST} == *linux* ]] && append-cppflags -DNO_LCHMOD
+       [[ ${CHOST} == *-irix* ]] && append-cppflags -DNO_LCHMOD
        use bzip2 && append-cppflags -DUSE_BZIP2
        use unicode && append-cppflags -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE
        append-lfs-flags #104315
        append-cppflags -DLARGE_FILE_SUPPORT #281473
 
+       sed -i \
+               -e '/^CFLAGS/d' \
+               -e '/CFLAGS/s!-O[0-9]\?!$(CFLAGS) $(CPPFLAGS)!' \
+               -e '/^STRIP/s!=.*!=true!' \
+               -e "s!CC=gcc !CC=$(tc-getCC) !" \
+               -e "s!LD=gcc !LD=$(tc-getCC) !" \
+               -e "s!CF = \$(CFLAGS) \$(CF_NOOPT)!CF = \$(CFLAGS) \$(CF_NOOPT) \$(CPPFLAGS)!" \
+               -e "s!AS=gcc !AS=$(tc-getCC) !" \
+               -e 's!LF2 = -s!LF2 = !' \
+               -e 's!LF = !LF = $(LDFLAGS) !' \
+               -e 's!SL = !SL = $(LDFLAGS) !' \
+               -e 's!FL = !FL = $(LDFLAGS) !' \
+               -e "/^#L_BZ2/s!^$(use bzip2 && echo .)!!" \
+               -e 's!STRIP =.*$!STRIP = true!' \
+               unix/Makefile \
+               || die "sed unix/Makefile failed"
+
        emake \
                -f unix/Makefile \
                ${TARGET} || die "emake failed"
Comment 1 Stuart Shelton 2009-08-20 11:10:57 UTC
Created attachment 201772 [details, diff]
unzip-6.0-irix.patch


Prevent IRIX build failures.
Comment 2 Fabian Groffen gentoo-dev 2009-08-20 11:15:44 UTC
why the move of this sed statement?
Comment 3 Stuart Shelton 2009-08-20 12:08:52 UTC
Note that the ':'s in the sed statement have been changed to '!'s, so as not to trip over potential colons in IRIX CFLAGS.

As it was, it looked a little odd... the current ebuild inserts $CFLAGS and $CPPFLAGS into unix/Makefile, and *then* uses append-flags/append-cppflags.

This way around all of the append-*flags stuff is done, and *then* the "$CFLAGS $CPPFLAGS" are pushed into unix/Makefile.  Also, the additional change to the CF variable won't work if the sed statement appears higher up.

But then, I could be missing something ;)
Comment 4 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-08-21 14:13:02 UTC
(In reply to comment #3)
> Note that the ':'s in the sed statement have been changed to '!'s, so as not to
> trip over potential colons in IRIX CFLAGS.

This is problematic for Gentoo in general. It will be hard to 'mandate' to not use ":" in sed statements... =/
Comment 5 Stuart Shelton 2009-08-21 16:30:31 UTC
(In reply to comment #4)
> This is problematic for Gentoo in general. It will be hard to 'mandate' to not
> use ":" in sed statements... =/

Sure, but if a change to teh ebuild is needed anyway, then I can't see it doing any harm (since I'm guessing that absolutely no-one uses '!' or '|' in their CFLAGS!) - and that way it'll spread... eventually.

(At the same time, perhaps there *should* be a GLEP stating that ':' should not be used when modifying CFLAGS, just as any character which could break on any platform should be avoided)


Actually, the list of potentially affected packages in prefix is not great:

app-arch/pbzip2
app-arch/unarj
app-crypt/aesutil
app-doc/doxygen
app-editors/elvis
app-editors/hteditor
app-editors/levee
app-misc/ondir
app-text/highlight
app-text/ispell
dev-lang/ferite
dev-libs/cyrus-sasl
dev-libs/libmemcached
dev-libs/zziplib
dev-util/darcs
dev-util/qgit
dev-util/valgrind
gnome-base/gnome-keyring
mail-client/mailx
mail-client/pine
mail-filter/procmail
mail-mta/ssmtp
media-gfx/tic98
media-gfx/xloadimage
media-libs/aalib
media-libs/ladspa-sdk
media-libs/urt
sci-biology/mrbayes
sci-chemistry/tinker
sys-devel/flex
sys-power/powertop
x11-libs/gtk+
x11-libs/qt-core
x11-plugins/bfm

... and many of these may not even be affected (or indeed, in cases such as powertop, even work on non-Linux platforms ;)
Comment 6 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-08-21 17:36:50 UTC
Sorry, I should have been more specific. I, personally, don't mind to change the sed statement. I just think it will be difficult to enforce that amongst Gentoo developers, so we don't have to constantly "fix" it. A GLEP is probably a good idea. Are you interested in drafting that? We could start by filing a new bug to get the conversation off of this one. Or the mailing list. I guess this needs to be done in tandem with adding IRIX support to Prefix.

Do you have a handle on the number of Prefix/IRIX users out there? I think you are pretty active in some forums, right?
Comment 7 SpanKY gentoo-dev 2009-08-24 06:29:46 UTC
your interpretation of the sed is incorrect.  you missed the difference in quoting (single vs double).  no flags are inserted in the src_unpack stage.
Comment 8 Stuart Shelton 2009-08-24 09:32:29 UTC
(In reply to comment #7)
> your interpretation of the sed is incorrect.  you missed the difference in
> quoting (single vs double).  no flags are inserted in the src_unpack stage.
> 

Ah, I see - my bad.

Please note that the additional:

    -e "s!CF = \$(CFLAGS) \$(CF_NOOPT)!CF = \$(CFLAGS) \$(CF_NOOPT)
\$(CPPFLAGS)!" \

... still needs to be present for IRIX, however.
Comment 9 Fabian Groffen gentoo-dev 2009-09-01 16:11:28 UTC
on darwin too
Comment 10 Fabian Groffen gentoo-dev 2009-09-01 16:25:19 UTC
sed statement added, IRIX patch added.  closing
Comment 11 Christoph Junghans (RETIRED) gentoo-dev 2012-12-17 16:31:51 UTC
Can somebody comment if the 
+# ifndef __sgi
+# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
+# define _LARGEFILE64_SOURCE
+# endif
is really necessary? Is there a problem with defining _LARGEFILE_SOURCE on irix?