Sunday, January 30, 2011

Patch for sl_proxy 1.9.3 for Mac and Cygwin

If you're comfortable with patch and make, you shouldn't have much trouble installing this. The instructions to compile are the same on both Mac and Cygwin. Linux users shouldn't have to make any changes, since this software was originally written for linux.
  1. Download sl_proxy-1.9.3 from Network Solutions Laboratory. It's the little 3.5" floppy disk icon.
  2. Extract the sources to a temp folder. I do this from a terminal command prompt:
    • mkdir -p ~/tmp/slproxy
    • cd ~/tmp/slproxy
    • tar xvzf ~/Desktop/sl_proxy-1.9.3.tar.gz
  3. Download my sl_proxy-1.9.3-mac-cygwin.patch from here. (The .patch extension might be hidden)
  4. Test applying the patch, just to be sure you're in the right spot.
    • cd ~/tmp/slproxy
    • patch --dry-run --strip=1 -i ~/Desktop/sl_proxy-1.9.3-mac-cygwin.patch
  5. If that works, apply the patch.
    • patch --strip=1 -i ~/Desktop/sl_proxy-1.9.3-mac-cygwin.patch
  6. Make the junkbox library.
    • cd ~/tmp/slproxy/junkbox_lib-1.2.4
    • autoreconf -f && ./configure && make
  7. Make the sl_proxy programs.
    • cd ../sl_proxy-1.9.3
    • autoreconf -f && ./configure && make
  8. Install them. On Mac, remember to 'sudo' the install command.
    • make install
Assuming that all worked, next you start the processes up. These apps are designed to be running as services or 'daemons' all the time. I haven't bothered to do that under Mac and it's more trouble than it is worth under Cygwin, so I simply start them by hand. If you want to explore them running as a service, feel free.

I recommend using 'screen' to run them. At the least, you'll probably want 3 terminal sessions. I set up some bash aliases to run them in my .profile, so I can just type sl1, sl2, and sl3 -- one in each terminal session. The sl_cache process, sl2 in my aliases, takes a bit to start up. It takes longer each time as you collect more and more textures. This is why I recommend screen if you leave your PC or Mac on most of the time -- because you can detach the session and log out and the apps will keep running.

Starting the apps by hand
On the Mac, you'll need to prefix each of these with 'sudo' because they run as privliged processes.
  1. sl_info -v0 -l -f1 -d
  2. sl_cache -v0 -l -lx -xpr 90 -d
  3. sl_relay -v0 -ci -cs -d
You should read the Network Solutions Laboratory's website for what each of the parameters mean.

In my .profile (or .bashrc, depending), I set up aliases as follows:
  • alias sl1="sl_info -v0 -l -f1 -d"
  • alias sl2="sl_cache -v0 -l -lx -xpr 90 -d"
  • alias sl3="sl_relay -v0 -ci -cs -d"
Pointing the Second Life client to your proxy
In order to start caching textures, you need to have your Second Life client talking to sl_proxy, and not directly to the Second Life servers.

Windows:
You can do this by putting the IP of your sl_proxy computer in the shortcut. Just copy your Second Life shortcut and perhaps rename it "Second Life - cache". Change your target to add the --loginuri parameter outside the quotes of the exe. For example: "SecondLife.exe" --loginuri http://computer:8100/cgi-bin/login.cgi
Make sure you replace 'computer' with the IP of the sl_proxy machine or use 'localhost' if it's on the same pc you'll run Second Life from.

Mac:
(instructions shamelessly stolen from the Opensimulator site)
  • Make a 'secondlife.sh' file, and put this in it:
#!/bin/bash
/Applications/Second\ Life.app/Contents/MacOS/Second\ Life -loginuri http://computer:8100/cgi-bin/login.cgi
  • set it to executable
  • run it
Good luck and I hope this app helps you out as much as I have. Those of you with FiOS and super-fast connections probably won't get anything from this. But people with slower connections will see things quicker as they move around in places they frequent.

Thursday, January 27, 2011

SL_Proxy 1.9.3 on Mac and Cygwin

In my old blog, I talked about this app a lot. It really saves my butt with my ISP. I just upgraded it yesterday and needed to patch the source again. So, I thought I'd write up what I needed to do.

First, here are my old posts on the subject:

This gets a little technical, so I apologize to those who don't quite follow along. Making a patch file for these is pretty easy, but the last time I did it, I didn't put in the version number. Unfortunately, my old patch file won't work on this source. I plan to make a new patch file this weekend, but I thought I'd write down what I did first.

For Mac:
  • Edit each of these Makefile.am files, changing all the instances of 'chown' from "chown nobody.$GRP" to "chown nobody:$$GRP"
    • sl_proxy-1.9.3/sl_info/Makefile.am
    • sl_proxy-1.9.3/sl_relay/Makefile.am
    • sl_proxy-1.9.3/sl_proxy/Makefile.am
    • sl_proxy-1.9.3/sip_forwarder/Makefile.am
  • autoreconf && ./configure && make
For Cygwin:
The problem is there's no yp headers in Cygwin. All one has to do is remove the checks, surrounding them with #ifndef __CYGWIN__ blocks.
  • junkbox_lib-1.2.4/Lib/password.h @ line 38
#ifndef __CYGWIN__
#include <rpcsvc/ypclnt.h>
#endif // __CYGWIN__

  • junkbox_lib-1.2.4/Lib/password.c
@line 58
#ifndef __CYGWIN__
// for NIS
pw = getnisnam(user_id);
if (pw!=NULL) {
strncpy(pass, pw->pw_passwd, LPASS);
free_pw(pw);
return pass;
}
#endif // __CYGWIN__
@line 74-164
#ifndef __CYGWIN__

/**
struct passwd* getnisnam(char* usrid)

(lots of code)

free(nis);
return pw;
}

#endif // __CYGWIN__

/**
void free_pw(struct passwd* pw)

These processes won't auto-start on boot, even if you run 'make install'. It will place the executables into /usr/local/bin and make some inet.d changes in /etc, but they aren't honored on boot. I always start them by hand, using 'screen' so I can easily disconnect or reconnect to see the logs. Like I wrote in my earlier posts, I create a screen console for each process and run these commands (on cygwin, you don't need to 'sudo'):
sudo /usr/local/bin/sl_info -l -v0 -d -f1
sudo /usr/local/bin/sl_cache -l -v0 -lx -xpr 90 -d
sudo /usr/local/bin/sl_relay -v0 -cs -ci -d