Skip to content

Instantly share code, notes, and snippets.

@Alhadis
Created May 1, 2020 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alhadis/9d8b39ebddad5d640ff6466fa17d9578 to your computer and use it in GitHub Desktop.
Save Alhadis/9d8b39ebddad5d640ff6466fa17d9578 to your computer and use it in GitHub Desktop.
Installing Snack for Tcl on macOS
DEST = $(HOME)/Library/Tcl
TCL = /System/Library/Frameworks/Tcl.framework
TK = /System/Library/Frameworks/Tk.framework
X = /Developer/SDKs/MacOSX10.6.sdk/usr/X11/include
all: ../unix/Makefile
cd ../unix && $(MAKE) && $(MAKE) install
../unix/Makefile:
cd ../unix && ./configure --disable-stubs --with-tcl=$(TCL) --with-tk=$(TK) CPPFLAGS=-I$(X)
sed -i.bak \
-e 's|^\(TCL_INCPATH[[:blank:]]*=\).*|\1 $(TCL)|' \
-e 's|^\(TK_INCPATH[[:blank:]]*=\).*|\1 $(TK)|' \
-e 's|^\(XINCLUDES[[:blank:]]*=\).*|\1 -I$(X)|' \
-e 's|^\(DESTDIR[[:blank:]]*=\).*|\1 $(DEST)|' \
-e 's|^\(SNACK_INSTALL_PATH[[:blank:]]*=\).*|\1|' $@
rm -f $@.bak
clean:
[ ! -f ../unix/Makefile ] || { cd ../unix && $(MAKE) distclean; }
git checkout -- ../unix ../demos
git clean -fd ../unix
.PHONY: clean
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh8.5 "$0" "$@"
package require sound
# Try to load optional file format handlers
catch { package require snacksphere }
catch { package require snackogg }
if {[llength $argv] == 0} {
puts {Usage: play.tcl file}
exit
} else {
set file [lindex $argv 0]
}
snack::sound s -file $file
s play
vwait forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment