Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 01 Sep 2014, 20:03
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Compiler GUI and other packaging tools
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 12 [172 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 10, 11, 12 Next
Author Message
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Sun 11 Oct 2009, 17:12    Post subject:  

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. Smile )

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.
pcompile-0.1.2.pet
Description  Pcompile 0.1.2, see above for changes.
pet

 Download 
Filename  pcompile-0.1.2.pet 
Filesize  4.18 KB 
Downloaded  543 Time(s) 
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Sun 11 Oct 2009, 18:18    Post subject:  

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.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Sun 11 Oct 2009, 21:22    Post subject:  

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 ....................

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Sun 11 Oct 2009, 21:46    Post subject:  

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?
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Sun 11 Oct 2009, 22:33    Post subject:  

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)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Sun 11 Oct 2009, 22:54    Post subject:  

Gedrean,

Quote:
but I'm trying to kill the second "


Perhaps you could knock off the last quote by
Code:

 pipe input | cut -d'"' -f1


There's probably some way to do it in sed also, but this seems easier.

Cheers,
s
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Sun 11 Oct 2009, 23:04    Post subject:  

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
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Sun 11 Oct 2009, 23:17    Post subject:  

Nevermind, found it. Thanks for the suggestion @seaside, but I found a bash integrated function (faster to call these than sed)

Code:
CFG1="`echo "$CHOOSER2" | grep WORD1 | sed 's/WORD1=//' | sed 's/\"//'`"
CFG1=${CFG1%\"}


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...

Code:
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
}


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.
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Sun 11 Oct 2009, 23:57    Post subject:  

technosaurus wrote:
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


I'm braindead as to which post you mean. Smile
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Mon 12 Oct 2009, 01:07    Post subject:  

nope its me, must have been somewhere else
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Mon 12 Oct 2009, 01:30    Post subject:  

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. Very Happy
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Mon 12 Oct 2009, 04:22    Post subject:  

is it \"
?

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2238

PostPosted: Mon 12 Oct 2009, 04:52    Post subject:  

You need the 'g' global option to sed:

sed 's/\"//g'
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Mon 12 Oct 2009, 13:38    Post subject:  

technosaurus wrote:
is it \"
?


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.

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.

amigo wrote:
You need the 'g' global option to sed:

sed 's/\"//g'


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.

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. Wink

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... Wink
Back to top
View user's profile Send private message 
Gedrean


Joined: 05 Jun 2009
Posts: 138

PostPosted: Mon 12 Oct 2009, 13:45    Post subject:  

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:
Code:
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
}


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! Smile

EDIT: Oooh, and single quotes are fine!!! I think that'll do pig! That'll do! HAHAHAHHA!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 12 [172 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 10, 11, 12 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0981s ][ Queries: 13 (0.0127s) ][ GZIP on ]