forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Suggested change to psp-config: symlink expansion

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
zino



Joined: 04 Feb 2005
Posts: 1

PostPosted: Thu Jun 30, 2005 7:36 am    Post subject: Suggested change to psp-config: symlink expansion Reply with quote

Rational:

I would like psp-config to expand symlinks so that the real installation directory is found. I use a package system that installs several versions of sofware in parallell and offer a symlink form to the default version of those packages. unwinding the symlink makes the psp-config work in my setup.

Suggested change (minus the huge comment):

--- tools/psp-config.c.orig 2005-06-29 23:34:23.000000000 +0200
+++ tools/psp-config.c 2005-06-29 23:35:51.000000000 +0200
@@ -135,6 +135,11 @@
int suffix_len;
int path_len;

+ /* unwind links to get to read installation, allowing
+ for several installation with links to the default
+ one from for example /usr/local */
+ while(readlink(path, path, MAX_PATH) != -1);
+
suffix_len = strlen(PSPDEV_PATH_SUFFIX);
path_len = strlen(path);
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Jun 30, 2005 9:06 am    Post subject: Reply with quote

Hmm, Ok. Once I figure out how to make it portable I'll put it in. Thanks.
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Thu Jun 30, 2005 10:55 pm    Post subject: Reply with quote

psp-config is already unportable, since it uses getopt_long...

I use a simple shellscript instead.
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Jun 30, 2005 11:12 pm    Post subject: Reply with quote

mc wrote:
psp-config is already unportable, since it uses getopt_long...

I use a simple shellscript instead.


And which systems don't have getopt_long()?
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Sat Jul 02, 2005 12:17 am    Post subject: Reply with quote

Solaris < 10 for sure. I'd _assume_ that IRIX, AIX, UNICOS et al don't have it either, but my test machines seem to be inaccessible at the moment. getopt_long() is a GNUism to begin with.
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
Guest






PostPosted: Sat Jul 02, 2005 12:23 am    Post subject: Reply with quote

Ok, I am a big fan of Solaris. But my god, who the heck develops homebrew ps2dev on Solaris, Irix, AIX, or...unicos ? :) Solaris I can almost see due to its widespread popularity as a commercial OS, but Irix is almost dead, and AIX tends to be on more expensive servers and the rare workstation.
Back to top
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Sat Jul 02, 2005 12:24 am    Post subject: Reply with quote

I do. Solaris 9.
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
Nick Fury



Joined: 22 Jun 2005
Posts: 45

PostPosted: Sat Jul 02, 2005 12:57 am    Post subject: Reply with quote

It's time you discovered an updated OS my friend.
Back to top
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Sat Jul 02, 2005 1:12 am    Post subject: Reply with quote

getopt_long is in libiberty.a if your platform libc doesn't have it. That goes for mingw also, as msvcrt lacks getopt_long (and getopt also).
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Jul 02, 2005 5:38 am    Post subject: Reply with quote

We'll come up with something. readlink() won't be used unless it was detected at configure time, and getopt_long() may be replaced, dunno yet.
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Sat Jul 02, 2005 9:38 pm    Post subject: Reply with quote

Seing as only one option is supported anyway, it shouldn't be a major issue to do without the call to getopt_long()... :-)

Code:
/* Process the arguments */
int process_args(int argc, char **argv)
{
    int i, ret = 0;
    g_printpath = 0;

    for(i=1; i<argc; i++)
         if(!strcmp(argv[i], "-p") || !strcmp(argv[i], "--pspsdk-path"))
         {
             g_printpath = 1;
             ret = 1;
         }
         else
         {
             fprintf(stderr, "Invalid option '%s'\n", argv[i]);
         }

    return ret;
}


Hm, I need to make a proper patch for the endian conversion code in (un)pack-pbp.c too. It uses "NXSwapInt()" without defining it...
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Sat Jul 02, 2005 9:39 pm    Post subject: Reply with quote

Nick Fury wrote:
It's time you discovered an updated OS my friend.


I see you are making a valuable contribution to making the SDK more portable. Keep up the good work.
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Sat Jul 02, 2005 9:45 pm    Post subject: Reply with quote

crazyc wrote:
getopt_long is in libiberty.a if your platform libc doesn't have it.


Yes, but the SDK does not link against libiberty. This can be fixed of course, but since libiberty might not be installed either, a better idea might be to include the getopt_long source from libiberty into the PSPSDK distro, and compile it if needed. libiberty is LGPL, so it should be possible (I haven't studied the AFL which the SDK is under to see if it's compatible though).
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Jul 02, 2005 10:15 pm    Post subject: Reply with quote

mc wrote:
libiberty is LGPL, so it should be possible (I haven't studied the AFL which the SDK is under to see if it's compatible though).


PSPSDK is actually BSD-licensed :). Yeah, I was thinking of just grabbing the source to getopt_long(), but anyone else is welcome to step in and fix it.
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Sat Jul 02, 2005 10:39 pm    Post subject: Reply with quote

I can do it if you give me write access. ;-)

Here's a patch for the endianness issue with (un)pack-pbp.c:
endian.patch

config.h.in will have to be regenerated too (is it a mistake that it is under version control? I expect so...).
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group