From 5ba1b587618ed09c169655f722bd72d9db82343b Mon Sep 17 00:00:00 2001
From: Nick White <git@njw.me.uk>
Date: Tue, 8 Nov 2011 23:01:19 +0000
Subject: Add gui starpack build rule

---
 Makefile        |  9 ++++++++-
 TODO            |  4 ++--
 config.mk       |  2 ++
 getxbookgui     | 30 ------------------------------
 getxbookgui.tcl | 30 ++++++++++++++++++++++++++++++
 5 files changed, 42 insertions(+), 33 deletions(-)
 delete mode 100755 getxbookgui
 create mode 100755 getxbookgui.tcl

diff --git a/Makefile b/Makefile
index 0428b51..4710acf 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ NAME = getxbook
 
 SRC = getgbook.c getabook.c
 LIB = util.o
-GUI = getxbookgui
+GUI = getxbookgui.tcl
 DOC = README COPYING INSTALL LEGAL
 EXTRAS = extras/mkpdf.sh extras/mkocrpdf.sh
 
@@ -31,6 +31,13 @@ util.a: $(LIB)
 	@$(AR) -r -c $@ $(LIB)
 	@ranlib $@
 
+getxbookgui.exe: getxbookgui.tcl
+	@echo STARPACK $@
+	@sdx qwrap getxbookgui.tcl
+	@sdx unwrap getxbookgui.kit
+	@sdx wrap $@ -runtime $(TCLKIT)
+	@rm -r getxbookgui.kit getxbookgui.vfs
+
 install: all
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
 	cp -f $(BIN) $(GUI) $(DESTDIR)$(PREFIX)/bin
diff --git a/TODO b/TODO
index 2855fc7..7133837 100644
--- a/TODO
+++ b/TODO
@@ -12,8 +12,6 @@ what happens if we receive not a http header? does recv loop forever, in a memor
 
 package for osx
 package for windows
-	have tcl as a starpack. have it always reference the executables in its directory, and we're golden.
-	http://www.digital-smarties.com/Tcl2002/tclkit.pdf
 
 use something smarter than update in gui to stop freezing
 
@@ -25,3 +23,5 @@ create 'pad' file (like a stupid version of doap), to get windows shareware folk
 	http://pad.asp-software.org/
 	http://padsites.asp-software.org/
 	http://pad.asp-software.org/repository/user/submit.php?Home=user
+	note that it must include all fields, with irrelevant ones being self-closed
+	(mostly there, needs cleaning and automating and self-closed crap)
diff --git a/config.mk b/config.mk
index ebcbb9f..e8d22f8 100644
--- a/config.mk
+++ b/config.mk
@@ -9,6 +9,8 @@ MANPREFIX = $(PREFIX)/share/man
 CFLAGS = -ansi -pedantic -Wall -Wextra -Werror -g -D_POSIX_C_SOURCE=200112L \
          -DVERSION=\"$(VERSION)\"
 
+TCLKIT = tclkit-8.5.9-win32.upx.exe
+
 # musl static
 #CC = musl-gcc
 #LDFLAGS = -static #-s
diff --git a/getxbookgui b/getxbookgui
deleted file mode 100755
index 56b6e63..0000000
--- a/getxbookgui
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/tclsh
-# See COPYING file for copyright and license details.
-package require Tk
-
-set bin [list getgbook getabook]
-
-proc go {} {
-	if { [.id get] == "" } { return }
-	set cmd "[.bin get [.bin curselection]] [.id get]"
-	.dl configure -state disabled -text "downloading"
-	update
-	set out [open "|$cmd 2>@1" "r"]
-	while {![eof $out]} {
-		set a [gets $out]
-		if { $a != "" } { .st configure -text $a }
-		update
-	}
-	.dl configure -state normal -text "download"
-	.st configure -text ""
-}
-
-label .lab -text "book id"
-entry .id
-listbox .bin -listvariable bin -exportselection 0
-.bin selection set 0
-button .dl -text "download" -command go
-label .st -relief sunken -width 20
-
-pack .lab .id .bin .dl .st
-bind . <Return> go
diff --git a/getxbookgui.tcl b/getxbookgui.tcl
new file mode 100755
index 0000000..56b6e63
--- /dev/null
+++ b/getxbookgui.tcl
@@ -0,0 +1,30 @@
+#!/usr/bin/tclsh
+# See COPYING file for copyright and license details.
+package require Tk
+
+set bin [list getgbook getabook]
+
+proc go {} {
+	if { [.id get] == "" } { return }
+	set cmd "[.bin get [.bin curselection]] [.id get]"
+	.dl configure -state disabled -text "downloading"
+	update
+	set out [open "|$cmd 2>@1" "r"]
+	while {![eof $out]} {
+		set a [gets $out]
+		if { $a != "" } { .st configure -text $a }
+		update
+	}
+	.dl configure -state normal -text "download"
+	.st configure -text ""
+}
+
+label .lab -text "book id"
+entry .id
+listbox .bin -listvariable bin -exportselection 0
+.bin selection set 0
+button .dl -text "download" -command go
+label .st -relief sunken -width 20
+
+pack .lab .id .bin .dl .st
+bind . <Return> go
-- 
cgit v1.2.3