Compiler GUI and other packaging tools
Alright, done. Pcompile 0.1.2, now installing pcompile to /root/my-applications/bin (you can change it in the pet/tgz if you want to, this is more of a bugfix and minor change to see if it works, then I'd suggest building a pet that puts it where it should go. )
Works great by making the pcompile_build directory, which makes for figuring out what got built where easier.
Used it to build the new Glade3, which didn't help in my GUI developing any because it doesn't seem to include things -- and it wouldn't have mattered, because gtkdialog3 requires certain libs that should be included with GTK but aren't, to make Glade files readable as interfaces... so back to the drawing board. Though I did find techno's handy-dandy reference of different functions to copy paste... so I think I'll do that, and then just copy out some stuff and do some copypasta to make it work with the checkboxes.
Anyhow, here's 0.1.2.
Works great by making the pcompile_build directory, which makes for figuring out what got built where easier.
Used it to build the new Glade3, which didn't help in my GUI developing any because it doesn't seem to include things -- and it wouldn't have mattered, because gtkdialog3 requires certain libs that should be included with GTK but aren't, to make Glade files readable as interfaces... so back to the drawing board. Though I did find techno's handy-dandy reference of different functions to copy paste... so I think I'll do that, and then just copy out some stuff and do some copypasta to make it work with the checkboxes.
Anyhow, here's 0.1.2.
- Attachments
-
- pcompile-0.1.2.pet
- Pcompile 0.1.2, see above for changes.
- (4.18 KiB) Downloaded 869 times
And I think now I've figured out how to do it. Thanks to your tutorial, and a little help here and there, I've figured out the elusive "notebook" tag, which has made doing this easier, though it's still not pretty.
In any case, it'll be better-ish for those tabs.
I might think it would be a good idea to split the actual file for the dialog to another file, and pcompile be designed to call that dialog and parse the results, then send those to src2all -- since it's a standalone program and can run easily without more than one argument, since it by default just takes a tarball of various types and compiles builds and pets it.
The only thing that concerns me is trying to figure out how to make pcompile pass arguments that have an = in them, as those were previously a challenge... I recall that was funky.
In any case, it'll be better-ish for those tabs.
I might think it would be a good idea to split the actual file for the dialog to another file, and pcompile be designed to call that dialog and parse the results, then send those to src2all -- since it's a standalone program and can run easily without more than one argument, since it by default just takes a tarball of various types and compiles builds and pets it.
The only thing that concerns me is trying to figure out how to make pcompile pass arguments that have an = in them, as those were previously a challenge... I recall that was funky.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Here are the Flags that work 99% of the time and make the compile faster and smaller.
CFLAGS=" -pipe -combine -Os -momit-leaf-frame-pointer -fomit-frame-pointer \
-fmerge-all-constants -mpreferred-stack-boundary=2 -march=i386 -mtune=i686 " \
CXXFLAGS=" -pipe -combine -Os -momit-leaf-frame-pointer -fomit-frame-pointer \
-fmerge-all-constants -mpreferred-stack-boundary=2 -march=i386 -mtune=i686 " \
LDFLAGS=" -Wl,-O4,-Os,-relax,--sort-common,--no-keep-memory,-s " \
./configure ....................
CFLAGS=" -pipe -combine -Os -momit-leaf-frame-pointer -fomit-frame-pointer \
-fmerge-all-constants -mpreferred-stack-boundary=2 -march=i386 -mtune=i686 " \
CXXFLAGS=" -pipe -combine -Os -momit-leaf-frame-pointer -fomit-frame-pointer \
-fmerge-all-constants -mpreferred-stack-boundary=2 -march=i386 -mtune=i686 " \
LDFLAGS=" -Wl,-O4,-Os,-relax,--sort-common,--no-keep-memory,-s " \
./configure ....................
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Okay. I'm at a wall here, so until I can figure that out I can't fix the "= in entry" bug we had before.
Instead of sed'ing out the " and = chars beforehand, then grepping, I grep first to get down to the varname="value" level.
From there I strip out the 'varname=' entirely, leaving me with "value".
I can sed out the first ", but I'm trying to kill the second ", and having a hell of a time figuring out a way. All the options with sed seem to match first occurrence, and anything with " in it needs to be preserved, but the last " does NOT need to be preserved, imho.
So, ideas?
Instead of sed'ing out the " and = chars beforehand, then grepping, I grep first to get down to the varname="value" level.
From there I strip out the 'varname=' entirely, leaving me with "value".
I can sed out the first ", but I'm trying to kill the second ", and having a hell of a time figuring out a way. All the options with sed seem to match first occurrence, and anything with " in it needs to be preserved, but the last " does NOT need to be preserved, imho.
So, ideas?
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
That is why I was suggesting integrating src2all - maybe a newer version of sed/grep/cat etc... who knows? I never figured that one out, but it is not applicable if you don't have to pass the parameters outside of the script (just paste src2all into the end of pcompile and fix $1, $2 and $3 to use the parameters in pcompile - noone really uses src2all directly - that is what T2 and src2pkg are for)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Gedrean,
There's probably some way to do it in sed also, but this seems easier.
Cheers,
s
Perhaps you could knock off the last quote bybut I'm trying to kill the second "
Code: Select all
pipe input | cut -d'"' -f1
Cheers,
s
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
actually if you look back at Barry's post maybe you can decode and apply it - at the time it was completely foreign to me - now its still like a 3rd language as I continue to learn the useful bash commands
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Nevermind, found it. Thanks for the suggestion @seaside, but I found a bash integrated function (faster to call these than sed)
First echo's out the value, sends it to grep to pull only WORD1, strips WORD1= (gets rid of that first =, sed's the first ", then does a end-strip of the last ".
Provided gtkdialog doesn't change its behavior for passing back values... this should work. I'd honestly be happy if there was a way to do it without sed...
And I've found that I can do it with that same expansion.
I'm building this as a complex function (well, not THAT complex) but so I can just remember what is happening without quite as hard to read...?
well hell, I got nearly everything I wanted... but I use an eval statement to push a value back OUT to the calling argument from a function... and it strips double quotes, and freaks out with single quotes.
Here's the code I have so far...
Apparently, ${x#$2=\"} says: Take $x, strip out from it the contents of $2 plus = plus ", from teh beginning.
Then, ${x%\"} says "take $x, strip the " from the end"
That gets rid of all the questionables, but if the user passes quotes in their args, unfortunately in that "echo $x " - that was arg1" line, it shows them, but when pushed back onto $arg1 using the eval the quotes get nuked by our good friend eval. How to resolve? I do want to do this with functions, so that the actual text in the script is more legible, and to minimize retyped stuff.
Code: Select all
CFG1="`echo "$CHOOSER2" | grep WORD1 | sed 's/WORD1=//' | sed 's/\"//'`"
CFG1=${CFG1%\"}
Provided gtkdialog doesn't change its behavior for passing back values... this should work. I'd honestly be happy if there was a way to do it without sed...
And I've found that I can do it with that same expansion.
I'm building this as a complex function (well, not THAT complex) but so I can just remember what is happening without quite as hard to read...?
well hell, I got nearly everything I wanted... but I use an eval statement to push a value back OUT to the calling argument from a function... and it strips double quotes, and freaks out with single quotes.
Here's the code I have so far...
Code: Select all
function pc_strip () # pc_strip arg1 arg2.
{
# arg1 should be the name of the var to strip with.
# arg2 should be the name of the variable from gtkdialog.
y=\$"$1" # y becomes "$arg1".
x=`eval "expr \"$y\" "` # x becomes value of $arg1, so $x = $arg1.
# finally start our strips.
x=${x#$2=\"} # strip out arg2=" from beginning
x=${x%\"} # strip out " from end
# now to protect any quotes.
echo $x " - that was arg1!"
eval "$1=$x" # push value back onto $arg1
}
Then, ${x%\"} says "take $x, strip the " from the end"
That gets rid of all the questionables, but if the user passes quotes in their args, unfortunately in that "echo $x " - that was arg1" line, it shows them, but when pushed back onto $arg1 using the eval the quotes get nuked by our good friend eval. How to resolve? I do want to do this with functions, so that the actual text in the script is more legible, and to minimize retyped stuff.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Honestly if I can't get it to keep the quotes it's no really big deal, but oh well.
If I don't have any idea by tomorrow how to get those quotes through, I'll just have it pass back and say whatever. As it is, it's still tremendous that I can get this to work that well.
I'm thinking, for checkboxes, I think there MAY be a way to have it be independent of the entries, but I don't know. I'm thinking this program is becoming complex enough I may look into freebasic for it... because that might be faster.
If I don't have any idea by tomorrow how to get those quotes through, I'll just have it pass back and say whatever. As it is, it's still tremendous that I can get this to work that well.
I'm thinking, for checkboxes, I think there MAY be a way to have it be independent of the entries, but I don't know. I'm thinking this program is becoming complex enough I may look into freebasic for it... because that might be faster.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Sadly, no, inside the string quoted stuff is passed without the loveliness of the backslash. I tried RELIGIOUSLY to change it, but it wouldn't take.technosaurus wrote:is it "
?
At this point I'm about giving up on keeping those quotes, since it's a compile-time option setting usually quotes shouldn't be there.
I know /g is a global functionality, I don't require that to nuke things. In fact I've nuked sed from usage entirely except in one instance that I can think of.amigo wrote:You need the 'g' global option to sed:
sed 's/"//g'
At this time I'm gonna go ahead and punch it in as a function and try to see if I can't make it checkbox-independent (meaning that ANY checkboxes, if name-formatted correctly, will be handled by some form of loop to add their function in -- this way furhter editing of the code won't be required if the actual interface is changed to add new 'defaults'.
Oh, and the flags strings you mentioned will be hardcoded - I'm not gonna try to have those pass, simply because they're quote-surrounded, and I'm getting absolutely sick of quotes.
Hope you don't feel bothered that I kinda threadjacked here and started making additions, but you hadn't updated it in a while and I saw room for other niceties <G> Hell maybe my version'll fizzle out and I'll recommend going back to the 0.1.0 (which worked rather well aside from the two glitches I fixed through 0.1.1...
So I just realized... since "eval" does some quote stripping all to hell... I don't NEED to strip quotes. I just eval it out, and make it go back out there, and the function instantly shortens in size and in content.
New function code:
I feel efficient. Well, not as efficient, I'm doing memory dereferences in a function in bash, but theoretically since all these functions are bash-internals, they should run much faster than an outside program like sed!
EDIT: Oooh, and single quotes are fine!!! I think that'll do pig! That'll do! HAHAHAHHA!
New function code:
Code: Select all
function pc_strip () # pc_strip arg1 arg2.
{
# arg1 should be the name of the var to strip with.
# arg2 should be the name of the variable from gtkdialog.
y=\$"$1" # y becomes "$arg1".
x=`eval "expr \"$y\" "` # x becomes value of $arg1, so $x = $arg1.
# finally start our strips.
x=${x#$2=} # strip out arg2= (no quote) from beginning
eval "$1=$x" # push value back onto $arg1, stripping quotes
}
EDIT: Oooh, and single quotes are fine!!! I think that'll do pig! That'll do! HAHAHAHHA!
Alright, new question. Are underscores "_" (not dashes "-") ever used in ./configure options, that we know of?
EDIT: Better yet. What characters are not able to be used in a bash command line string, for example as arguments of ./configure. That is to say, they must be \-escaped first, or just will not work b/c bash will interpret them as something else and screw up the command?
EDIT: Better yet. What characters are not able to be used in a bash command line string, for example as arguments of ./configure. That is to say, they must be \-escaped first, or just will not work b/c bash will interpret them as something else and screw up the command?
Wow, okay. I'm sorry to say that with decent documentation (documenting out in detail how I got my tricks to work, for example) the file size is HUGEMONGOUS for pcompile.
That being said, in pet form it'll be much smaller, but I expect overall the project may grow to single-digit kilobyte size.
At least, my submission for it.
HOWEVER -- I'm building it so that if we add another checkbox later for default options, then no additional code will need to be added to pcompile - thus the only changes need be done to the window file...
Oh, did I mention, I split off the dialogbox description into a separate file, so it's easier to read and manage?
If you want me to stop mutilating your project, techno, please say so. I hate to trod on toes.
That being said, in pet form it'll be much smaller, but I expect overall the project may grow to single-digit kilobyte size.
At least, my submission for it.
HOWEVER -- I'm building it so that if we add another checkbox later for default options, then no additional code will need to be added to pcompile - thus the only changes need be done to the window file...
Oh, did I mention, I split off the dialogbox description into a separate file, so it's easier to read and manage?
If you want me to stop mutilating your project, techno, please say so. I hate to trod on toes.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I wouldn't really worry about size/speed too much. Speed should still be insignificant when compared to compile time and size will still be smaller than the smallest binary used during compilation. Keep in mind that it would require the devx anyway. Just wondering - have you gotten src2all to work with python programs?
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
I got nothing on that front.technosaurus wrote:I wouldn't really worry about size/speed too much. Speed should still be insignificant when compared to compile time and size will still be smaller than the smallest binary used during compilation. Keep in mind that it would require the devx anyway. Just wondering - have you gotten src2all to work with python programs?
As it is, I've got a while do done loop doing the checkboxes... With a little work... I finished the loop.
Now I've just got to reiterate my previous question:
Are there any characters in Bash which are UNABLE to be used in arguments by default, like % or whatever, that are unlikely to be included in ./configure arguments?
Thanks!