You are not logged in.

#1 2014-05-29 15:22:50

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

[solved-solved]one variable, 2 values.

WARNING DON"T USE THIS EXAMPLE FOR YOUR PKGBUILD - qinohe

Hi, looking for a solution of the next example.
The 2nd  echo part should stay as it is..

As I'm looking at it for days now already, tried some things,
for loop, if statement, but I can't get it to work.

The variable, 'wow', could be 'yes', as well as ,'no'

I think,it's the part between the lines, I'm missing.
Can someone point me in the right direction?

If I invoke the script, and choose e.g. ,aa & cc, the output should be,

yesandaa 
noandbb 
yesandcc 
noanddd
#!/bin/bash
set -u
set -e
		hit=$(hit 2>/dev/null) || hit=/tmp/hit
		trap 'rm -f "$hit"' 0 1 2 5 15
		DIALOG=${DIALOG=dialog}

		$DIALOG --backtitle "" \
			      --title "" --clear \
			      --checklist "" 11 30 5 \
		"aa" "" on \
		"bb" "" on \
		"cc" "" on \
		"dd" "" on  2>/tmp/hit;

		retval=$?

		HIT=$(cat "$hit")

		case $retval in
		   0)
			  
	            	if [[ ! -f "$hit" ]]; then
                       	echo "hit not found!, using hat."
                       	fi
		#------------------------------------
		#------------------------------------  
			echo ''$wow'and'aa' 
		        	      '$wow'and'bb' 
		               '$wow'and'cc' 
		               '$wow'and'dd''
			;;
		esac
exit 0

Thanks, qinohe

Last edited by qinohe (2014-06-01 16:48:51)


-I can give you a ladder, but you need to climb it yourself-

Offline

#2 2014-05-29 15:36:37

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: [solved-solved]one variable, 2 values.

qinohe wrote:

The variable, 'wow', could be 'yes', as well as ,'no'

You never assign a value to this variable in the code you provided. So, if this variable has any value, it's because it's inherited from the parent shell.

Offline

#3 2014-05-29 15:47:18

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

Alright then 'wow' doesn't get a value this way, i figured that one out already smile but how should I go about, doing that.
How could I make the script so, that 'wow' can have 2 values, without touching the 2nd echo part?

And thanks for your tips, why not to use 'set -e & u' in this thread.

Last edited by qinohe (2014-05-29 15:58:56)


-I can give you a ladder, but you need to climb it yourself-

Offline

#4 2014-05-29 16:36:08

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: [solved-solved]one variable, 2 values.

qinohe wrote:

How could I make the script so, that 'wow' can have 2 values, without touching the 2nd echo part?

It simply isn't possible, nor does it make sense.

Last edited by falconindy (2014-05-29 16:42:20)

Offline

#5 2014-05-29 16:46:14

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,437
Website

Re: [solved-solved]one variable, 2 values.

Yeah, I'm so confused by your question. sad

Although the title of your thread made me think of Python:

#!/usr/bin/python3
both = 'blarg', 3
print(both)

Last edited by drcouzelis (2014-05-29 16:46:49)

Offline

#6 2014-05-29 16:47:28

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

falconindy wrote:
qinohe wrote:

How could I make the script so, that 'wow' can have 2 values, without touching the 2nd echo part?

It simply isn't possible.

Thanks,well thats sad, you know, I just created this script to simplify.
The thing I tried to do was using dialog to catch input on the'.configure part of a PKGBUILD.
Is it possible to do that in a different way then?, and is it useful to create this kind of inline scripts for a PKGBUILD?


-I can give you a ladder, but you need to climb it yourself-

Offline

#7 2014-05-29 16:49:55

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

drcouzelis wrote:

Yeah, I'm so confused by your question. sad

Although the title of your thread made me think of Python:

#!/usr/bin/python3
both = 'blarg', 3
print(both)

big_smile , I understand you are confused, I was a little myself too..

See answer above your Q. #6

Last edited by qinohe (2014-05-29 16:51:56)


-I can give you a ladder, but you need to climb it yourself-

Offline

#8 2014-05-29 17:17:52

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: [solved-solved]one variable, 2 values.

qinohe wrote:

The thing I tried to do was using dialog to catch input on the'.configure part of a PKGBUILD.
Is it possible to do that in a different way then?, and is it useful to create this kind of inline scripts for a PKGBUILD?

No, please never do this. PKGBUILDs should not be interactive.

Last edited by falconindy (2014-05-29 17:18:10)

Offline

#9 2014-05-29 17:34:36

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

falconindy wrote:

No, please never do this. PKGBUILDs should not be interactive.

I didn't know this, I promise, I won't submit interactive PKGBUILD's. Is there a reason why they shouldn't be interactive?

Problem solved, I guess if I want a script that gives me that output (see first code part #1), I try another route.
Thanks for your answers falconindy & drcouzelis.


-I can give you a ladder, but you need to climb it yourself-

Offline

#10 2014-06-01 01:21:38

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: [solved-solved]one variable, 2 values.

They shouldn't be interactive because PKGBUILDs are for automatically building a package.

Offline

#11 2014-06-01 02:15:12

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,692
Website

Re: [solved-solved]one variable, 2 values.

I've reread this thread several times - it seems to make less sense every time through.  It's like reading a Dr Seuss book on acid.

qinohe - there are creative ways to approach nearly every problem, but at least for me it's not remotely clear what the problem is.  Can you give simple examples of what kinds of outputs/results you are trying to produce from what kinds of inputs?


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#12 2014-06-01 08:51:22

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

Barrucadu wrote:

They shouldn't be interactive because PKGBUILDs are for automatically building a package.

Yeah, I understand that now, I just couldn't find anything saying that, except you people.

Trilby wrote:

I've reread this thread several times - it seems to make less sense every time through.  It's like reading a Dr Seuss book on acid.

qinohe - there are creative ways to approach nearly every problem, but at least for me it's not remotely clear what the problem is.  Can you give simple examples of what kinds of outputs/results you are trying to produce from what kinds of inputs?

Haha, yeah, I think I'm discovering the boundaries of bash,.

Yes Trilby, I can explain what I was doing, it's not that complicated.  Made a PKGBUILD for MOC svn version.
I know there is one, Mr.Elendig is maintaining that one, but mine, has less dependencies and will not be interactive anymore.

What I wanted, is to give more power to the user, in my build is a 'DIALOG' sound system  part and a '.configure' part
So you could choose the things you want MOC to configure with, and I wanted to do that with DIALOG. This is the package I talk about.
Basically, you wouldn't have to change anything, just start 'makepkg'. I hope this makes more sense, thanks.

# Maintainer: qinohe\ed\gmail
pkgname=moc-svn-dev
pkgver=2546
pkgrel=1
pkgdesc="A MOC svn development version"
arch=('x86_64' 'armv6h')
url="http://moc.daper.net"
license=('GPL')
depends=('libltdl' 'file')
makedepends=('subversion')
optdepends=('curl: Tool for transferring data with URL syntax'
            'faad2: Open source MPEG-4 and MPEG-2 AAC decoder'
            'ffmpeg: Record, convert, stream audio and video.'
            'flac: Free Lossless Audio Codec'
            'jack: JACK audio support'
            'taglib: Audio Meta-Data Library'
            'libid3tag: ID3 tags, audio file data standard for MP3 files'
            'libmad: Support MPEG-1, -2 & -2.5, like MP3'
            'libmodplug: Libs. to play MOD files'
            'libmpcdec: Libs.for Musepack, audio compression format'
            'libtimidity: Software synthesizer, convert MIDI to PCM'            
            'libvorbis: Libs. for playing Ogg files'
            'sidplay2: Play C64 (Commodore) mono & stereo file formats'
            'speex: A Free Codec For Free Speech'
            'wavpack: Hybrid Lossless Audio Compression')
provides=(moc)
conflicts=(moc)
options=('!libtool')
md5sums=('SKIP')

_svntrunk=svn://daper.net/moc/trunk
_svnmod=moc

build() {
		cd "$srcdir"
		msg "Connecting to SVN server...."
		
		if [[ -d "$_svnmod/.svn" ]]; then
		(cd "$_svnmod" && svn up -r "$pkgver")
		else
		svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod"
		fi
		
		msg "SVN checkout done or server timeout"
		msg "Starting build..."
		
		rm -rf "$srcdir/$_svnmod-build"
		svn export "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
		cd "$srcdir/$_svnmod-build"

                                           #-----------------THIS IS REMOVED---------------#
			soundsys=$(soundsys 2>/dev/null) || soundsys=/tmp/soundsys
			trap 'rm -f "$soundsys"' 0 1 2 5 15
			DIALOG=${DIALOG=dialog}
			
			$DIALOG --backtitle "Choose your soundsystem'." \
			        --title "Default soundsystem to be set?" --clear \
			        --radiolist "" 11 30 5 \
			"alsa" "" off \
			"jack" "" off \
			"oss"  "" off  2>/tmp/soundsys;
			
			retval=$?
			
 			soundsystem=$(cat "$soundsys")
 			case $retval in
			   0)
			
 			if [[ ! -f "$soundsys" ]]; then
			     echo "soundsys not found, use generic"
 			fi
			
			export CPPFLAGS="${CPPFLAGS} -I/usr/lib/$soundsystem/include"
			
 			esac	
                                           #-------------END---------------------#		
 		autoreconf -i				
			
		./configure --prefix=/usr \
					--bindir=/usr/bin \
					--sbindir=/usr/bin \
					--enable-debug \
					--without-aac \
					--with-alsa \
					--with-curl \
					--with-ffmpeg \
					--without-flac \
					--without-jack \
					--without-modplug \
					--with-mp3  \
					--without-musepack \
					--without-oss \
					--with-rcc \
					--with-samplerate \
					--without-sidplay2 \
					--without-sndfile \
					--without-speex \
					--without-timidity \
					--with-vorbis \
					--with-wavpack

  make
}

package() {
  cd "$srcdir/$_svnmod-build"
  make DESTDIR="$pkgdir/" install
}
# vim:set ts=2 sw=2 et:

BTW. mediawiki is always messing up the <code>, this is the same on my own wiki.


-I can give you a ladder, but you need to climb it yourself-

Offline

#13 2014-06-01 11:11:06

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,692
Website

Re: [solved-solved]one variable, 2 values.

I still don't see where one variable having two values would come in.  I just see an interactive PKGBUILD where the user would select a sounds system.

If they were able to chose more than one, the multiplle values could either be in an array or concatenated in a string and separated with spaces.

choices="alsa jack"
for choice in $choices; do
   CPPFLAGS="${CPPFLAGS} -I/usr/lib/$choice/include"
done

## OR

choices=("alsa" "jack")
for choice in "${choices[@]}"; do
   CPPFLAGS="${CPPFLAGS} -I/usr/lib/$choice/include"
done

Either of these would work just fine.  I'm not sure whether it'd be best to store $DIALOG's output in an array or string as you haven't defined what DIALOG is - but that seems beside the point.  This is not a limitation of bash: you can easily get multiple results and use all of them.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#14 2014-06-01 11:51:36

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

Trilby wrote:

I still don't see where one variable having two values would come in.  I just see an interactive PKGBUILD where the user would select a sounds system.

No, it's not about soudsystem, that was in the build, and I removed that part. It's about the '.configure' part, I would like to be able to choose.
If you look back at #1, the second part should replace the configure part, though, it's not possible that way.

If they were able to chose more than one, the multiplle values could either be in an array or concatenated in a string and separated with spaces.

choices="alsa jack"
for choice in $choices; do
   CPPFLAGS="${CPPFLAGS} -I/usr/lib/$choice/include"
done

## OR

choices=("alsa" "jack")
for choice in "${choices[@]}"; do
   CPPFLAGS="${CPPFLAGS} -I/usr/lib/$choice/include"
done

Either of these would work just fine.  I'm not sure whether it'd be best to store $DIALOG's output in an array or string as you haven't defined what DIALOG is - but that seems beside the point.  This is not a limitation of bash: you can easily get multiple results and use all of them.

Well that for loop works fine, thanks for that, so I always use a for loop in these cases, but still, I shouldn't use these things in a PKGBUILD, right?
What part of DIALOG didn't I define?
edit; congratulations on becoming a forum moderator wink

Last edited by qinohe (2014-06-01 12:00:15)


-I can give you a ladder, but you need to climb it yourself-

Offline

#15 2014-06-01 12:10:02

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,692
Website

Re: [solved-solved]one variable, 2 values.

qinohe wrote:

No, it's not about soudsystem, that was in the build, and I removed that part.

So when I asked for an example to show what you were trying to do you instead showed a PKGBUILD with the relevant part removed??

qinohe wrote:

I shouldn't use these things in a PKGBUILD, right?

Correct, PKGBUILDs should not be interactive.  I just wanted to clarify what you claimed may be a limitation in bash - I see no reason for such a conclusion and I saw it as an opportunity to work a new problem (fun for me, potential learning for you).

But as it is *still* completely unclear what variable you'd like to have two values, I guess I can't proceed with that.  The example in post #1 is too abstract and obscurred to mean anything (hat/hit, cat in the hat, "aaa" "bbb" "ccc", what do these things represent).  The more recent example for selecting sound systems is a much clearer example - but now you say it was not actually an example of what you were talking about, so I read it for no reason.

qinohe wrote:

What part of DIALOG didn't I define?

Oops, sorry, I missed the line where it was defined - *if* this were to be a PKGBUILD, dialog would have to be added to the makedepends.

qinohe wrote:

congratulations on becoming a forum moderator wink

Thanks


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#16 2014-06-01 12:25:47

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

Trilby wrote:

So when I asked for an example to show what you were trying to do you instead showed a PKGBUILD with the relevant part removed??

Yep, sorry, my bad, I will post the correct part at the bottom.

Correct, PKGBUILDs should not be interactive.  I just wanted to clarify what you claimed may be a limitation in bash - I see no reason for such a conclusion and I saw it as an opportunity to work a new problem (fun for me, potential learning for you).

Sure, I'd like to see it evolve too, as I really think it is possible..

But as it is *still* completely unclear what variable you'd like to have two values, I guess I can't proceed with that.  The example in post #1 is too abstract and obscurred to mean anything (hat/hit, cat in the hat, "aaa" "bbb" "ccc", what do these things represent).  The more recent example for selecting sound systems is a much clearer example - but now you say it was not actually an example of what you were talking about, so I read it for no reason.

You know, I always thought, simplifying a problem makes it easier, but thats not the case, I see. No, I really have that soundsytem part in my own PKGBUILD, it works.)

Oops, sorry, I missed the line where it was defined - *if* this were to be a PKGBUILD, dialog would have to be added to the makedepends.

Ah, thats a very valuable tip, thanks for that.)

The part it's about

 			mco1='aac'
 			mco2='alsa'
			mco3='curl'
 			mco4='ffmpeg'
			mco5='flac'
			mco6='jack'
			mco7='modplug'
			mco8='mp3'
			mco9='musepack'
			mco10='oss'
 			mco11='rcc'
 			mco12='samplerate'
 			mco13='sidplay2'
 			mco14='sndfile'
			mco15='speex'
  			mco16='timidity'
  			mco17='vorbis'
			mco18='wavpack'
			
  			confmoc=$(confmoc 2>/dev/null) || confmoc=/tmp/confmoc
  			trap 'rm -f "$confmoc"' 0 1 2 5 15
 			DIALOG=${DIALOG=dialog}

			$DIALOG --backtitle "Create your personal MOC player." \
			        --title "Choose options to compile." --clear \
			        --checklist "" 11 30 5 \
  			"$mco1" "" on \
 			"$mco2" "" on \
 			"$mco3" "" on \
 			"$mco4" "" on \
 			"$mco5" "" on \
  			"$mco6" "" on \
  			"$mco7" "" on \
			"$mco8" "" on \
  			"$mco9" "" on \
 			"$mco10" "" on \
			"$mco11" "" on \
 			"$mco12" "" on \
  			"$mco13" "" on \
  			"$mco14" "" on \
 			"$mco15" "" on \
 			"$mco16" "" on \
 			"$mco17" "" on \
 			"$mco18" "" on  2>/tmp/confmoc;

 			retval=$?

 			CONFMOC=$(cat "$confmoc")

			case $retval in
			  0)
			  
	                if [[ ! -f /tmp/confmoc ]]; then
                        echo "confmoc not found!, use all options."
                        fi
				
			if [ "$mco1..mco18" = "$confmoc" ]; then
			wiorwo='with'
			else
			wiorwo='without'
			fi
				  
			./configure --prefix=/usr \
				    --bindir=/usr/bin \
				    --sbindir=/usr/bin \
				    --enable-debug \
				    --'$wiorwo'-'$mco1' \
				    --'$wiorwo'-'$mco2' \
				    --'$wiorwo'-'$mco3' \
				    --'$wiorwo'-'$mco4' \
				    --'$wiorwo'-'$mco5' \
				    --'$wiorwo'-'$mco6' \
				    --'$wiorwo'-'$mco7' \
				    --'$wiorwo'-'$mco8'  \
				    --'$wiorwo'-'$mco9' \
				    --'$wiorwo'-'$mco10' \
				    --'$wiorwo'-'$mco11' \
				    --'$wiorwo'-'$mco12' \
				    --'$wiorwo'-'$mco13' \
				    --'$wiorwo'-'$mco14' \
				    --'$wiorwo'-'$mco15' \
				    --'$wiorwo'-'$mco16' \
				    --'$wiorwo'-'$mco17' \
				    --'$wiorwo'-'$mco18'
					;;
			esac

  make

-I can give you a ladder, but you need to climb it yourself-

Offline

#17 2014-06-01 12:48:15

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,692
Website

Re: [solved-solved]one variable, 2 values.

I'm not sure what that if block right before the configure is supposed to do, but now I see what you are going for - and it is certainly possible in bash (just not appropriate in a PKGBUILD).  I take it the wiorwo variable is what you want holding more than one value.  That would work fine if it were an array (but that if block would need revising).  Then your configure lines would be of the form "--${wiorwo[1]}-${mco1}".  Note also that variables in single quotes wont be expanded, though that is a separate issue.

For this use, if I understand it, an array of wiorwo variables wouldn't actually serve much purpose.  See the following for an alternative - I've reduced the options available to four, but others can be added by simply adding them to the first array:

opts_avail=( "alsa" "curl" "jack" "flac" )
dialog_opts=""
conf_opts=""

for opt in "${opts_avail[@]}"; do
	dialog_opts="$dialog_opts \"$opt\" \"\" on"
done

dialog --backtitle "Create your personal MOC player." \
			        --title "Choose options to compile." --clear \
			        --checklist "" 11 30 5 $dialog_opts 2>/tmp/confmoc

for opt in "${opts_avail[@]}"; do
	if grep -w -q "$opt" /tmp/confmoc; then
		conf_opts="$conf_opts --with-$opt"
	else
		conf_opts="$conf_opts --without-$opt"
	fi
done

./configure --prefix=/usr \
    # other basics here \
   $conf_opts

make

InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#18 2014-06-01 13:18:24

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

Trilby wrote:

I'm not sure what that if block right before the configure is supposed to do, but now I see what you are going for - and it is certainly possible in bash (just not appropriate in a PKGBUILD).  I take it the wiorwo variable is what you want holding more than one value.  That would work fine if it were an array (but that if block would need revising).  Then your configure lines would be of the form "--${wiorwo[1]}-${mco1}".

Yeah, I thought it would be possible, It is very nasty to get a grip on all possibilities, bash is very versatile. Well I just pasted what I had, since I was not clear on what to do, this was what I could come up with, agree it's messy.
Yes, the wiorwo variable is the one expanding to, in this case, 'with' or 'without'

Note also that variables in single quotes wont be expanded, though that is a separate issue.

I am aware of that, but since there are scores, it would only expand like this, at least the $mco part.

For this use, if I understand it, an array of wiorwo variables wouldn't actually serve much purpose.  See the following for an alternative - I've reduced the options available to four, but others can be added by simply adding them to the first array:

opts_avail=( "alsa" "curl" "jack" "flac" )
dialog_opts=""
conf_opts=""

for opt in "${opts_avail[@]}"; do
	dialog_opts="$dialog_opts \"$opt\" \"\" on"
done

dialog --backtitle "Create your personal MOC player." \
			        --title "Choose options to compile." --clear \
			        --checklist "" 11 30 5 $dialog_opts 2>/tmp/confmoc

for opt in "${opts_avail[@]}"; do
	if grep -w -q "$opt" /tmp/confmoc; then
		conf_opts="$conf_opts --with-$opt"
	else
		conf_opts="$conf_opts --without-$opt"
	fi
done

./configure --prefix=/usr \
    # other basics here \
   $conf_opts

make

Very nice Triby, I like it.) I need to study this a little bit more because this total new way of declaring '$VAR's', and need to study arrays a little more.
If I have managed to build, I will show the result fake PKGBUILD, thanks for the help so far.

Last edited by qinohe (2014-06-01 13:19:11)


-I can give you a ladder, but you need to climb it yourself-

Offline

#19 2014-06-01 16:47:59

qinohe
Member
From: A Dutch location..)
Registered: 2012-06-20
Posts: 649

Re: [solved-solved]one variable, 2 values.

Success, very nice, to bad we can't use it for PKGBUILD.

Well, it was quite simple actually I just had to implement, configure was winning about a new line, but autoreconf was at the wrong place, so that solved.

Thank you very much for helping me solve this, Trilby, to me the 'rabbit hole' opened up a little, so, where should Alice go next? wink
Thanks to all for your reply, qinohe
The result PKGBUILD
@ other users: don't use this PKGBUILD as example, it's a bad one

# Maintainer: qinohe@gmail.com
pkgname=moc-svn-dev
pkgver=2546
pkgrel=1
pkgdesc="A MOC svn development version"
arch=('x86_64' 'armv6h')
url="http://moc.daper.net"
license=('GPL')
depends=('libltdl' 'file' 'dialog')
makedepends=('subversion')
optdepends=('curl: Tool for transferring data with URL syntax'
            'faad2: Open source MPEG-4 and MPEG-2 AAC decoder'
            'ffmpeg: Record, convert, stream audio and video.'
            'flac: Free Lossless Audio Codec'
            'jack: JACK audio support'
            'taglib: Audio Meta-Data Library'
            'libid3tag: ID3 tags, audio file data standard for MP3 files'
            'libmad: Support MPEG-1, -2 & -2.5, like MP3'
            'libmodplug: Libs. to play MOD files'
            'libmpcdec: Libs.for Musepack, audio compression format'
            'libtimidity: Software synthesizer, convert MIDI to PCM'            
            'libvorbis: Libs. for playing Ogg files'
            'sidplay2: Play C64 (Commodore) mono & stereo file formats'
            'speex: Free Codec For Free Speech'
            'wavpack: Hybrid Lossless Audio Compression')
provides=(moc)
conflicts=(moc)
options=('!libtool')
md5sums=('SKIP')

_svntrunk=svn://daper.net/moc/trunk
_svnmod=moc

build() {
		cd "$srcdir"
		msg "Connecting to SVN server...."

		if [[ -d "$_svnmod/.svn" ]]; then
		(cd "$_svnmod" && svn up -r "$pkgver")
		else
		svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod"
		fi

		msg "SVN checkout done or server timeout"
		msg "Starting build..."

		rm -rf "$srcdir/$_svnmod-build"
		svn export "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
		cd "$srcdir/$_svnmod-build"
		
			soundsys=$(soundsys 2>/dev/null) || soundsys=/tmp/soundsys
			trap 'rm -f "$soundsys"' 0 1 2 5 15
			DIALOG=${DIALOG=dialog}
			
			$DIALOG --backtitle "Choose your soundsystem'." \
			        --title "Default soundsystem to be set?" --clear \
			        --radiolist "" 11 30 5 \
			"alsa" "" off \
			"jack" "" off \
			"oss"  "" off  2>/tmp/soundsys;
			
			retval=$?
			
 			soundsystem=$(cat "$soundsys")
 			case $retval in
			   0)
			
 			if [[ ! -f "$soundsys" ]]; then
			     echo "soundsys not found, use generic"
 			fi
		
			choices="$soundsystem"
			for choice in $choices; do
				CPPFLAGS="${CPPFLAGS} -I/usr/lib/$choice/include"
			done
			esac

		autoreconf -i
			
			opts_avail=( "aac" "alsa" "curl" "ffmpeg" "flac" "jack" "modplug" "mp3" "musepack" "oss" "rcc" "samplerate" "sidplay2" "sndfile" "speex" "timidity" "vorbis" "wavpack" )
			dialog_opts=""
			conf_opts=""
			
			for opt in "${opts_avail[@]}"; do
				dialog_opts="$dialog_opts \"$opt\" \"\" on"
			done
			
			dialog --backtitle "Create your personal MOC player." \
						        --title "Choose options to compile." --clear \
						        --checklist "" 11 30 5 $dialog_opts 2>/tmp/confmoc
			
			for opt in "${opts_avail[@]}"; do
				if grep -w -q "$opt" /tmp/confmoc; then
					conf_opts="$conf_opts --with-$opt"
				else
					conf_opts="$conf_opts --without-$opt"
				fi
			done

			
			./configure --prefix=/usr \
						--enable-debug \
						--bindir=/usr/bin \
						--sbindir=/usr/bin \
						--enable-debug \
						$conf_opts
						
    make
}

package() {
  cd "$srcdir/$_svnmod-build"
  make DESTDIR="$pkgdir/" install
}

# vim:set ts=2 sw=2 et:

-I can give you a ladder, but you need to climb it yourself-

Offline

Board footer

Powered by FluxBB