Add privoxy package to haikuports Haiku
Status: Closed Time to complete: 72 hrs Mentors: Dario Casalinuovo Tags: .bep, haikuporter, package, haikuports, privoxy, haiku, porting, package manager

http://ports.haiku-files.org/

Your .bep file should be able to handle gcc2 or gcc4 builds.  If it fails to build with gcc2, then adding a Message into the .bep file explaining that should be added.

There are lots of example .bep files in svn on the Haikuports site.

NOTE: The tool is known to compile without any change in the source code (maybe just some headers naming/path or preprocessor changes, side where i can help as well...), your job is to make a .bep file that would automate these steps using haikuporter.

You should also configure properly the binary, setting the appropriated settings directory using configure command line arguments.

Also be sure to check your work before submit it.

---------

The tool is available at the following URL :

http://www.privoxy.org/

Uploaded Work
File name/URL File size Date submitted
privoxy-3.0.18.bep 615 bytes December 16 2011 22:23 UTC
privoxy-3.0.18.bep 840 bytes December 17 2011 03:34 UTC
Comments
Thomas Turney on December 14 2011 22:15 UTC Task Claimed

I would like to work on this task.

Dario Casalinuovo on December 14 2011 22:43 UTC Task Assigned

This task has been assigned to Thomas Turney. You have 72 hours to complete this task, good luck!

Dario Casalinuovo on December 15 2011 16:00 UTC Just a concern

I just wanted to mention that since it's a medium task, and you have already some experience, i'm expecting more efforts in making it working. Also if it needs adapting the build system without broking other platforms. However i don't expect c/c++ etc. work from you.


Regards

Thomas Turney on December 15 2011 22:11 UTC Understood

I usually find sometimes pieces of a Makefile when compiling do need to be altered, usually I use sed -i with the alteration. I have haiku finally installed on an actual machine (netbook, it runs wonderfully), so I will be capable of testing in both gcc2 and gcc4. I hope to have something for you hopefully in a few hours!

Dario Casalinuovo on December 15 2011 22:29 UTC Reply

Using sed is what i meant, basically someone have to replace your hacks before committing it to haikuports, so modifying the build system without breaking other operating systems is needed. Remember it's a medium task.


Basically, in general it's simple, what is not needed by haiku can be transformed in a variable that can be disabled when using haiku as host system, similarly what Haiku need can be also put into some variable.


Submit no-paste and problems here, mentors can supply useful suggestions on how to do that.

Dario Casalinuovo on December 15 2011 22:32 UTC Some more considerations

As said, if you don't want to use the diff and patch commands to do that, you can just submit both your modified package and bep file, this way, i can add the patch command in the bep easily.

Thomas Turney on December 16 2011 02:06 UTC Pthread and lpcre

After configuring and running make, the program fails with many errors seemingly related to pthread and lpcre. I've not looked into lpcre yet, but is pthread necessary for haiku?


I found some comments relating to pthread here: https://www.haiku-os.org/community/forum/does_haiku_core_development_have_a_pthreads_package_yet


But I'm not quite sure exactly if haiku supports it now and how I can enable it through make.


An aside note, in the INSTALL, it mentions "WARNING: If installing as root, the install will fail unless a non-root user or group is specified, or a privoxy user and group already exist on the system."


When running make, exactly what user am I? root user? or just a regular user?


-thanks!

Thomas Turney on December 16 2011 02:28 UTC Some progress

I managed to find and remove the -pthread flag from GNUMakefile (regular Makefile has no such thing), since libroot appears to have everything needed (according to the discussion post. I did deal with a libm problem before on google code in, so I understand libroot has the necessary components) as well as the lpcre flag. Everything seemed to compile correctly up to the point of:


gcc -c -pipe -O2    -Wall  pcre/maketables.c -o pcre/maketables.o
gcc -c -pipe -O2    -Wall  pcre/study.c -o pcre/study.o
pcre/dftables >pcre/chartables.c
runtime_loader: Cannot open file libpthread.so.2: No such file or directory
make: *** [pcre/chartables.c] Error 3


Here you can see  once I hit pcre/dftables with chartables.c libpthread showed up again. Any idea as to where I can edit out libpthread?

Thanks!

-Thomas

Dario Casalinuovo on December 16 2011 15:07 UTC Possible solution

Set as uset baron and as group users. About the pthread problem, i need to look more deeply. Can you post the entire build output? You can do it this way : "anycommand -a thparameter > log.txt".


Really it seems to me that something was not compiled or configured. Also the file NON-UNIX-USE looks interesting, but most of the steps are unuseful on Haiku, i suspect this is just referred to windows.

Dario Casalinuovo on December 16 2011 15:48 UTC another consideration

It seems that pcre use their own configure commands, maybe they should be run separately? Just to be sure you have checked it.

Thomas Turney on December 16 2011 17:36 UTC Some good news, some bad

I have so far gone through many steps to find what I could about the build, but it seems with every bug I fix another surfaces. :) Pthread, however, is no longer an issue. I figured out dftables was already compilied when you download the source, so it already "expects" pthread since that was the environment it was compilied in. Simply deleting it fixes the issue, since the source is included and make will automatically build another using the haiku environment. So far the steps I have taken are:


autoheader
autoconf
./configure --prefix=/boot/common
sed -i 's/$(PTHREAD_LIB)//' GNUmakefile
sed -i 's/= -pthread/=/' GNUmakefile
sed -i 's/-lpcre//' GNUmakefile
cd pcre
rm dftables


This will fix most of the issues. The new set of issues seems to deal with jbsockets. I am looking into what the issue with that is now. The source appears to have __BEOS__, so I assume there is a way to make it Haiku with relative ease (at least, that's what I hope).


I will no-paste the log of my compile in a moment.


-Thomas

Thomas Turney on December 16 2011 17:37 UTC Paste log

here's the latest make (which fails)


http://pastebin.com/z2y4Ea8M

Dario Casalinuovo on December 16 2011 17:53 UTC Reply

The undefined reference errors are caused because something should be linked to libnetwork.so (-lnetwork).


As said : don't use sed in the final bep please! I've already explained why and how in a previous reply.

Thomas Turney on December 16 2011 18:40 UTC Understood

I will not include sed in the final bep. I'll just send you the altered files to be diff'd against (the only one appears to be GNUmakefile)


I found setting env CFLAGS = -D__BEOS__ can get the neccessary files for jbsockets.c, or altering jbosckets.c by replacting BEOS with HAIKU will also do the same. This gets rid of the pastebin errors I previously sent. With my luck though, a new set seems to have surfaced:


http://pastebin.com/CHTEGcen


I'm not sure about exactly what it might mean other than that socket.h is missing, so I'm guessing I may have configured it incorrectly (couldn't find from /boot/common prefix) or I don't have socket.h installed on this machine (in which case, maybe needs it as a dependency?).


 


I'll look into it, but I have to pick up my sisters from school right now. Let me know if there's a specific direction I should go in to fix the errors as well as if setting -D__BEOS__ in CFLAGS is the best way to go or by replacing __BEOS__ in jbsockets.c with __HAIKU__ is the best way. Or if there's another way I might have missed.


Thanks again for all your help,


-Thomas

Dario Casalinuovo on December 16 2011 19:12 UTC Suggestions

Probably, replacing #include <sockets.h> with #include <sys/sockets.h> will solve the problem. This can be handled then using this c preprocessor code (in the .c/cpp file), with something like the following code :


#ifdef __HAIKU__


#include <sys/sockets.h>


#else


#include <sys/sockets.h>


#endif


About the __BEOS__ flag, i think this should be replaced with __HAIKU__.


For the moment you can just try and see if adding "sys/" solve the problem. If you have some c skill, you'll find easy to add the preprocessor code, let me know if you can't do that.

Thomas Turney on December 16 2011 19:53 UTC Reply

I tried out adding sys, which would make sense considering socket.h wasn't found in the first place (some seraching online stated it was in sys, but I hadn't realized you needed to add sys/ into the code. sys/socket.h did work,, and make did *appear* to be going correctly (despite the numerous warning messages that popped up), but it failed yet again. 


To keep you updated, here's the new list of errors (although I think the first gcc did succeed in building, since a second gcc seemed to be invoked): 
http://pastebin.com/J8bAS4sd


I'm looking into this now, and should have the rest of the night to dedicate to this project.

Dario Casalinuovo on December 16 2011 20:07 UTC undefined reference

Same as befoere, when they claim "recv, connect, gethostbyname ecc" it means that the binary code related to BSD sockets is missing, and in haiku it's contained in libnetwork : )

Thomas Turney on December 16 2011 22:23 UTC Ready for review

The work on this task is ready to be reviewed.

Thomas Turney on December 16 2011 22:28 UTC Some comments

I made the .bep file which contains the ./configure and setup necessary to build everything correctly. 


I do have the file of jbsockets.c in which BEOS is renamed HAIKU and socket.h renamed sys/socket.h; however I found that without altering the text in this file it will still compile. 


My only concerns that I was unable to check was getting gcc2 working (filters.c always appears to fail) and also exactly how bad --disable-pthread is. I assume it negated the -pthread CFLAG, which it does, but I'm not sure if it negates any potential use of pthread (since it's included in libroot). I think it is only the CFLAG that appears commented out of the GNUmakefile though.
  Also I've never actually used the software myself. Running ./privoxy *seems* to work, but I have no idea how to setup a proxy and the usage instructions on the website appear a bit complex. I wonder if I should move certain files after compliling or if the compiiler did that itself with the prefix=/boot/common argument.


If you have any trouble or if there's anything I need to alter or fix, please let me know.


Thanks,


-Thomas

Dario Casalinuovo on December 17 2011 00:47 UTC Work considerations

The work looks good, just a note : your INSTALL part is building and not installing (make install). The BUILD section isn't building (make).


What are your problems with gcc2? Can you explain a bit, or give some example/errors?

Dario Casalinuovo on December 17 2011 00:47 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Thomas Turney on December 17 2011 02:03 UTC gcc2 problems

Problems with gcc2 are pasted here from trying to build:
http://pastebin.com/vjumnRK8


I will change make to 'make install' in the install portion and add a comment in the .bep file that it only compiles on gcc4.

Dario Casalinuovo on December 17 2011 02:38 UTC Reply

Ok, submit the work and i'll accept the task.


You have more other task, that you can do :


http://google-melange.appspot.com/gci/task/view/google/gci2011/7232212


http://google-melange.appspot.com/gci/task/view/google/gci2011/7210231


http://google-melange.appspot.com/gci/task/view/google/gci2011/7226205

Thomas Turney on December 17 2011 03:34 UTC Ready for review

The work on this task is ready to be reviewed.

Dario Casalinuovo on December 17 2011 03:44 UTC Task Closed

Congratulations, this task has been completed successfully.