General :  K-Meleon Web Browser Forum
General discussion about K-Meleon. Questions about how to setup it, macro coding, all related to its usage and the project itself, including this website. 
Cleaning the chrome with a Unix computer
Posted by: fast sjonny
Date: May 30, 2005 05:16PM

For people who have a Windows AND Linux/Unix computer, the following script can be interesting. I have made this script for cleaning the jar-files in the chrome on my Linux computer, but ofcourse you can clean the jar-files on the Linux computer and use them in combination with KM on a windows-system.

The script is cleaning almost all copyright texts, textblocks etc... Some blocks are not deleted because they are a combination of some information about settings and the copyright.

This is the script:

function cleanjar()
{
# remove unneccessary text from comm.jar
unzip comm.jar
clean
zip -1r comm.jar content
rm -rf content
# remove unneccessary text from en-unix.jar
unzip en-unix.jar
clean
zip -1r en-unix.jar locale
rm -rf locale
# remove unneccessary text from en-US.jar
unzip en-US.jar
clean
zip -1r en-US.jar locale
rm -rf locale
# remove unneccessary text from messenger.jar
unzip messenger.jar
clean
zip -1r messenger.jar content
rm -rf content
# remove unneccessary text from modern.jar
unzip modern.jar
clean
zip -1r modern.jar skin
rm -rf skin
# remove unneccessary text from pipnss.jar
unzip pipnss.jar
clean
zip -1r pipnss.jar content
rm -rf content
# remove unneccessary text from pippki.jar
unzip pippki.jar
clean
zip -1r pippki.jar content
rm -rf content
# remove unneccessary text from toolkit.jar
unzip toolkit.jar
clean
zip -1r toolkit.jar content
rm -rf content
# remove unneccessary text from US.jar
unzip US.jar
clean
zip -1r US.jar locale
rm -rf locale
}

function clean() # this function is called in function cleanjar
{
# remove in *.js files:
# /* *** to *** */ license blocks,
# /**<enter> to */ text blocks,
# /*<enter> to */ textblocks,
# tabs on empty lines,
# empty lines:
find . -name '*.js' | xargs sed --in-place --line-length=0 -e '/\/\*\ \*\*\*/,/\*\*\*\ \*\// d' -e '/\/\*\*$/,/\*\// d' -e '/\/\*$/,/\*\// d' -e 's/[ ^I]*$//' -e '/^$/ d'
# remove in *.css files:
# /* *** to *** */ license blocks,
# tabs on empty lines,
# empty lines:
find . -name '*.css' | xargs sed --in-place --line-length=0 -e '/\/\*\ \*\*\*/,/\*\*\*\ \*\// d' -e 's/[ ^I]*$//' -e '/^$/ d'
# remove in *.xul files:
# <!-- --> one-liners,
# <!-- to --> blocks,
# tabs on empty lines,
# empty lines:
find . -name '*.xul' | xargs sed --in-place --line-length=0 -e '/<!--.*.-->/d' -e '/<!--/,/-->/d' -e 's/[ ^I]*$//' -e '/^$/ d'
# remove contents.rdf files:
find . -name 'contents.rdf' | xargs rm -rf
}

When you change the 1r to 0r the files are only copied into the jars and not compressed; when you change the 1r to 9r, the compression will be better, but it takes a little more time.

One last note; do not use this script for chromes which will be made available on the internet OR find a way to cover the copyright. I am responsable for that part!!!!!

Jan.

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: guenter
Date: May 31, 2005 04:13AM

will that work with all cygnus dev tools (can be on win32 pc 2). regards

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: fast sjonny
Date: May 31, 2005 05:24AM

I don't know Guenter.
It is Unix command-line language, using the commands find, xargs, sed, zip, unzip and rm...

May be interesting, I have also started the discussion about copyright again:
http://forums.mozillazine.org/viewtopic.php?t=273062

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: everling
Date: May 31, 2005 06:13AM

All the tools you mentioned, in your second post, exists in cygwin. I think it can be made to work. =)

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: fast sjonny
Date: May 31, 2005 12:45PM

Okay, changed it here and there and I am using a copyright.txt file now, which I copy into the root of the chrome-directory for use in the jar files.
I have read the GNU website and official you have to mention at least one line with the original owner, link and date. This is not in the script already, but a good chance I will add it somewhere this week.

The script:

unzip -q comm.jar
clean
zip -9mqr comm.jar content
zip -qu comm.jar copyright.txt
unzip -q en-unix.jar
clean
zip -9mqr en-unix.jar locale
zip -qu en-unix.jar copyright.txt
unzip -q en-US.jar
clean
zip -9mqr en-US.jar locale
zip -qu en-US.jar copyright.txt
unzip -q messenger.jar
clean
zip -9mqr messenger.jar content
zip -qu messenger.jar copyright.txt
unzip -q modern.jar
clean
zip -9mqr modern.jar skin
zip -qu modern.jar copyright.txt
unzip -q pipnss.jar
clean
zip -9mqr pipnss.jar content
zip -qu pipnss.jar copyright.txt
unzip -q pippki.jar
clean
zip -9mqr pippki.jar content
zip -qu pippki.jar copyright.txt
unzip -q toolkit.jar
clean
zip -9mqr toolkit.jar content
zip -qu toolkit.jar copyright.txt
unzip -q US.jar
clean
zip -9mqr US.jar locale
zip -qm US.jar copyright.txt
}

function clean()
{
# remove in *.js files:
# // text lines, /* *** to *** */ license blocks, /* -*- to *** */ license blocks, /**<enter> to */ text blocks, /*<enter> to */ textblocks, tabs on empty lines, empty lines:
find . -name '*.js' | xargs sed --in-place --line-length=0 -e 's/\/\/ .*//' -e '/\/\*\ \-\*\-/,/\*\*\*\ \*\// d' -e '/\/\*\ \*\*\*/,/\*\*\*\ \*\// d' -e '/\/\*\*$/,/\*\// d' -e '/\/\*$/,/\*\// d' -e 's/[ ^I]*$//' -e '/^$/ d' 2>/dev/null

# remove in *.css files:
# /* :::: to :::: */ one-liners, /* *** to *** */ license blocks, tabs on empty lines, empty lines:
find . -name '*.css' | xargs sed --in-place --line-length=0 -e '/\/\* \:\:\:\:\:.*.\:\:\:\:\: \*\//d' -e '/\/\*\ \*\*\*/,/\*\*\*\ \*\// d' -e 's/[ ^I]*$//' -e '/^$/ d' 2>/dev/null

# remove in *.xul files:
# // text lines, <!-- --> one-liners, <!-- to --> blocks, tabs on empty lines, empty lines:
find . -name '*.xul' | xargs sed --in-place --line-length=0 -e 's/\/\/ .*//' -e '/<!--.*.-->/d' -e '/<!--/,/-->/d' -e 's/[ ^I]*$//' -e '/^$/ d' 2>/dev/null

# remove in *.xml files:
# <!-- --> one-liners, <!-- to --> blocks, tabs on empty lines, empty lines:
find . -name '*.xml' | xargs sed --in-place --line-length=0 -e '/<!--.*.-->/d' -e '/<!--/,/-->/d' -e 's/[ ^I]*$//' -e '/^$/ d' 2>/dev/null

# remove contents.rdf files:
find . -name 'contents.rdf' | xargs rm -f
}

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: guenter
Date: May 31, 2005 02:16PM

it is only needed if Mozi ppl complain:
then afaik only in US - not yet here in EC... C discussion about software patents.
regards

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: fast sjonny
Date: May 31, 2005 08:49PM

I think not Guenter; just read this: http://www.gnu.org/copyleft/gpl.html

A single line is needed in every file as a minimum...

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: guenter
Date: June 01, 2005 04:46AM

EC law about software patents is afaik not passed yet, so older regulations that do not accept software patents are in rule in most European countries (Holland?)

there must be a certain level of newness or uniqueness
- trivial patents are only possible in certain countries ( e. g. the US ).

sorry do not know what a patent is in English or Dutch.

Options: ReplyQuote
Re: Cleaning the chrome with a Unix computer
Posted by: Carson
Date: June 01, 2005 05:30AM

A patent is a patent in English. It is like a copyright. A copyright usually protects a person who writes something. A patent protects a person who invents something.

You would probably patent a new kind of hard drive, and copyright a new software program. Both words are used as nouns, verbs, and (sometimes) adjectives.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.