Friday, November 28, 2008

EAPI 2: SRC_URI Arrows implementation in portage

Background: http://ciaranm.wordpress.com/2008/09/28/eapi-2-src_uri-arrows/

Today I found arrows in SRC_URI is not working in my box, so I took a look at the code, found something, and sent this:
http://www.nabble.com/a-little-patch-related-to-arrow-in-SRC_URI-td20732745.html

However, as Zac pointed out, the better solution is not to define your own fetch and resume command but rely on the default one.

The default ones are defined in /etc/make.globals:
FETCHCOMMAND="/usr/bin/wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
The rules of thumb is to make sure you save the file at ${DISTDIR}/${FILE}, since FILE is just the file name, doesn't include path.

Previously I have fetch and resume command defined in make.conf, and have used "-P ${DISTDIR}" instead of "-O ${DISTDIR}/${FILE}". Maybe portage should give warnings on this situation.

I encountered this problem when trying to install sopcast from gentoo china overlay.
Sopcast is a p2p stream TV software.
The latest ebuild uses arrows in SRC_URI, since its upstream doesn't include version in source tarball's file name. It is contributed by Hong Hao.

Labels: ,

Tuesday, November 11, 2008

A problem in Loongson 2F specific integer operation instruction patch

I have reported on gcc mailing list.
http://gcc.gnu.org/ml/gcc/2008-11/msg00076.html

Also I found the solution:
http://gcc.gnu.org/ml/gcc/2008-11/msg00087.html

Now I have built gcc-4.4 with my modified patch with "-march=mips3", and am building itself again using "-march=loongson2f".

Note that enabling -O2 in later stages is not working yet. Please check this bug report for more information if you are interested:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38052

EDIT:
just heard from Kumba, this flag used together with -O1 will trigger this bug:
-foptimize-sibling-calls
Optimize sibling and tail recursive calls.

Enabled at levels -O2, -O3, -Os.

The modified gcc 4.4 ebuild is here and some relevant libraries here.

Labels: , ,

Saturday, November 08, 2008

Gcc 4.4 Loongson 2F specific integer multiply/divide instruction patch

http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00273.html
I have put it in my loongson overlay.
BTW, the gcc svn ebuild is from dirtyepic's overlay. Thanks, ;)

zhangle@2f ~ $ cat hello.c
#include<stdio.h>
int mul(){
unsigned long a = 0xffffffff;
unsigned long b = 0xf;
return a * b;
}
zhangle@2f ~ $ gcc -march=loongson2f hello.c -S
zhangle@2f ~ $ gcc -march=mips3 hello.c -S -o hello-mips3.s
zhangle@2f ~ $ diff -u hello.s hello-mips3.s
--- hello.s 2008-11-08 18:16:52.000000000 +0800
+++ hello-mips3.s 2008-11-08 18:16:55.000000000 +0800
@@ -25,7 +25,8 @@
sw $2,8($fp)
lw $3,12($fp)
lw $2,8($fp)
- multu.g $2,$3,$2
+ mult $3,$2
+ mflo $2
move $sp,$fp
lw $fp,20($sp)
addiu $sp,$sp,24