aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-05-19 13:28:11 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commit9aa2ca76fa5b5b6454e93f0d596d684cbe969825 (patch)
tree1187930170de8e5112c7cb0a66a31603a8be32bc
parentupdate featured video (diff)
downloadalive-9aa2ca76fa5b5b6454e93f0d596d684cbe969825.tar.gz
alive-9aa2ca76fa5b5b6454e93f0d596d684cbe969825.zip
once again, revamp windows distribution
-rw-r--r--dist/.gitignore3
-rwxr-xr-xdist/fix-bat-script.sh24
-rwxr-xr-xdist/pack-win.sh90
-rw-r--r--dist/release.bat32
-rwxr-xr-xdist/release.sh4
-rw-r--r--dist/win/README.md15
-rw-r--r--dist/win/build-lua.bat24
-rw-r--r--dist/win/deps/fltk4lua-0.1-1.rockspec127
-rw-r--r--dist/win/deps/osc-1.0.1-1.rockspec47
-rw-r--r--dist/win/deps/wlua.c16
-rw-r--r--dist/win/fix-paths.sh31
-rw-r--r--dist/win/gen-readme.sh23
-rw-r--r--dist/win/wrappers/alv-fltk.bat3
-rw-r--r--dist/win/wrappers/alv-lib/README.txt4
-rw-r--r--dist/win/wrappers/alv.bat3
-rw-r--r--dist/win/wrappers/lua/lua.bat7
-rw-r--r--dist/win/wrappers/lua/luarocks.bat5
-rw-r--r--dist/win/wrappers/lua/luarocks.config.lua0
18 files changed, 342 insertions, 116 deletions
diff --git a/dist/.gitignore b/dist/.gitignore
index b6c0f93..fcc0a96 100644
--- a/dist/.gitignore
+++ b/dist/.gitignore
@@ -1,4 +1,7 @@
*.zip
+*.tar.gz
*.rock
*.rock.asc
alive-test-999.*
+alive-*-win/
+win/deps/*/
diff --git a/dist/fix-bat-script.sh b/dist/fix-bat-script.sh
deleted file mode 100755
index 0a3c8f0..0000000
--- a/dist/fix-bat-script.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-IN=$1
-MODE=$2
-
-head -n 2 $IN
-
-cat <<EOF
-set PR=%~dp0..\\
-set PP=%PR:\\=/%
-EOF
-
-PP="D:/alive_pkg/lua/"
-PR=${PP//\//\\\\}\\\\?
-
-if [ "$MODE" = wlua ]; then
- tail -n 2 $IN | \
- sed -r "s|${PR}|%PR%|g" | \
- sed "s|${PP}|%PP%|g" | \
- sed 's|"%PR%bin\\lua5.3.exe"|start "Lua" "%PR%bin\\wlua5.3.exe"|'
-else
- tail -n 2 $IN | \
- sed -r "s|${PR}|%PR%|g" | \
- sed "s|${PP}|%PP%|g"
-fi
diff --git a/dist/pack-win.sh b/dist/pack-win.sh
deleted file mode 100755
index d9b35f3..0000000
--- a/dist/pack-win.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/sh
-
-TAG="$1"
-ROCKVER="$2"
-LUA_WIN="$3"
-if [ -z "$LUA_WIN" ]; then
- LUA_WIN="/mnt/d/alive_pkg/lua"
-fi
-
-BUNDLE="alive-$TAG-win"
-ROCK="alive-$ROCKVER.all.rock"
-
-set -e
-
-if [ "$TAG" = "test" ]; then
- rm -rf "dist/$BUNDLE" "dist/$BUNDLE.zip"
-fi
-
-if [ -e "dist/$BUNDLE.zip" ]; then
- echo "dist/$BUNDLE.zip already exists!"
- exit 2
-fi
-
-if [ -e "dist/$BUNDLE" ]; then
- echo "dist/$BUNDLE already exists!"
- exit 2
-fi
-
-mkdir -p "dist/$BUNDLE"
-
-cp -r docs hello.alv LICENSE "dist/$BUNDLE/"
-rm -rf "dist/$BUNDLE/docs/"*.md "dist/$BUNDLE/docs/"*.ltp "dist/$BUNDLE/docs/gen"
-cp -r "$LUA_WIN" "dist/$BUNDLE/"
-
-cat <<EOF >"dist/$BUNDLE/alv.bat"
-@echo off
-%~dp0lua\bin\alv.bat --nocolor %*
-exit /b %ERRORLEVEL%
-EOF
-
-cat <<EOF >"dist/$BUNDLE/alv-fltk.bat"
-@echo off
-%~dp0lua\bin\alv-fltk.bat %*
-exit /b %ERRORLEVEL%
-EOF
-
-for script in "dist/$BUNDLE/lua/bin/"*.bat; do
- case "$(basename "$script" .bat)" in
- alv-fltk|alv-wx) mode="wlua" ;;
- *) mode= ;;
- esac
- dist/fix-bat-script.sh "$script" $mode > "$script.nu"
- mv "$script.nu" "$script"
-done
-
-mkdir "dist/$BUNDLE/alv-lib"
-cat <<EOF >"dist/$BUNDLE/alv-lib/README.txt"
-You can use this directory to add extensions to alv.
-See the extension documentation here for more information:
-
-https://alv.s-ol.nu/stable/internals/topics/extensions.md.html
-EOF
-
-cat <<EOF >"dist/$BUNDLE/README.md"
-alive $TAG
-==========
-
-https://alv.s-ol.nu
-https://github.com/s-ol/alive
-
-License
--------
-alive is licensed under the GPLv3 free and open-source license, a copy of which
-you can find in the file \`LICENSE\`.
-
-This binary distribution of alive contains the Lua interpreter, LuaRocks package
-manager, and a number of Lua modules licensed under various terms. Lua and
-LuaRocks are both licensed under the MIT license. The packages can be found
-within the \`lua\` directory while their individual licensing information may be
-viewed using \`luarocks.bat\`:
-
- cmd.exe> luarocks.bat list
- cmd.exe> luarocks.bat show moonscript
- cmd.exe> luarocks.bat show ...
-EOF
-
-(
- cd dist/
- zip -rm "$BUNDLE.zip" "$BUNDLE"
-)
diff --git a/dist/release.bat b/dist/release.bat
new file mode 100644
index 0000000..7224e7a
--- /dev/null
+++ b/dist/release.bat
@@ -0,0 +1,32 @@
+SETLOCAL
+SET TAG=%1
+SET ROCK=%2
+SET DEPS=%~dp0win\deps
+SET BUNDLE=alive-%TAG%-win
+rmdir /Q /S dist\%BUNDLE%
+mkdir dist\%BUNDLE%
+
+mkdir dist\%BUNDLE%\lua
+mkdir dist\%BUNDLE%\lua\bin
+mkdir dist\%BUNDLE%\lua\include
+copy /Y %DEPS%\lua-5.3.5\bin\* dist\%BUNDLE%\lua\bin\
+copy /Y %DEPS%\lua-5.3.5\include\* dist\%BUNDLE%\lua\include\
+copy /Y %DEPS%\luarocks-3.3.1-windows-64\luarocks.exe dist\%BUNDLE%\lua\bin\
+copy /Y hello.alv dist\%BUNDLE%\
+copy /Y LICENSE dist\%BUNDLE%\LICENSE.txt
+xcopy /E /I docs dist\%BUNDLE%\docs
+xcopy /E /I dist\win\wrappers\* dist\%BUNDLE%\
+
+cd dist\%BUNDLE%\lua
+call luarocks install busted
+call luarocks install %DEPS%\osc-1.0.1-1.rockspec
+call luarocks install luarocks-fetch-gitrec
+call luarocks install luarocks-build-cpp
+call luarocks install %DEPS%\fltk4lua-0.1-1.rockspec FLTK_LIBDIR=%DEPS%\fltk-1.3.5\lib FLTK_INCDIR=%DEPS%\fltk-1.3.5
+call luarocks --server https://luarocks.org/manifests/s-ol install %ROCK%
+cd ..\..\..
+
+set DIST_UNIX=%~dp0%BUNDLE%\lua\
+set DIST_UNIX=%DIST_UNIX:\=/%
+bash dist/win/fix-paths.sh %DIST_UNIX% %BUNDLE%
+sh dist/win/gen-readme.sh %BUNDLE% %TAG%
diff --git a/dist/release.sh b/dist/release.sh
index 8048c88..f0fb73f 100755
--- a/dist/release.sh
+++ b/dist/release.sh
@@ -127,6 +127,6 @@ if [ -n "$TAG" ]; then
luarocks make "dist/rocks/alive-$VERSION-$REVISION.rockspec" $ROCK_OPTS \
--deps-mode none --pack-binary-rock
mv "alive-$VERSION-$REVISION.all.rock"* dist/rocks
- echo "now install 'alive-$VERSION-$REVISION.all.rock' on windows and run"
- echo dist/pack-win.sh "$TAG" "$VERSION-$REVISION"
+ echo "now run this in a windows dev cmd.exe:"
+ echo dist\win\release.bat "$TAG" "dist/rocks/alive-$VERSION-$REVISION.all.rock"
fi
diff --git a/dist/win/README.md b/dist/win/README.md
new file mode 100644
index 0000000..6b1e1e1
--- /dev/null
+++ b/dist/win/README.md
@@ -0,0 +1,15 @@
+Building & Packaging on Windows
+===============================
+
+1. download and build dependencies
+ - Lua:
+ - download `lua-5.3.5.tar.gz` and extract in `dist/win/deps`
+ - run `dist\\win\\build-lua.bat`
+ - luarocks:
+ - downlaod `luarocks-3.3.1-windows-64.zip` and extract in `dist/win/deps`
+ - FLTK:
+ - download `fltk-1.3.5-source.tar.gz` and extract in `dist/win/deps`
+ - compile the fltkdll project in `fltk-*/ide/VisualC2010/` in Release mode
+2. build or obtain an alive binary rock (`alive-VERSION-REVISION.all.rock`)
+3. run `dist\\release.bat VERSION path\to\alive-VERSION-REVISION.all.rock`
+4. zip `dist\alive-VERSION-win` and distribute
diff --git a/dist/win/build-lua.bat b/dist/win/build-lua.bat
new file mode 100644
index 0000000..ac89935
--- /dev/null
+++ b/dist/win/build-lua.bat
@@ -0,0 +1,24 @@
+cd %~dp0deps
+
+cd lua-5.3.5
+del /F /Q bin include
+mkdir bin
+mkdir include
+copy /Y ..\wlua.c src
+copy /Y src\lua*.h include
+copy /Y src\lua.hpp include
+copy /Y src\lauxlib.h include
+
+cd src
+del *.obj *.o *.lib
+cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c
+ren lua.obj lua.o
+ren luac.obj luac.o
+ren wlua.obj wlua.o
+link /DLL /IMPLIB:lua5.3.5.lib /OUT:../bin/lua5.3.dll *.obj
+copy lua5.3.5.lib ..\bin\lua5.3.lib
+link /OUT:../bin/lua5.3.exe /SUBSYSTEM:CONSOLE lua.o lua5.3.5.lib
+link /OUT:../bin/wlua5.3.exe /SUBSYSTEM:WINDOWS wlua.o lua.o lua5.3.5.lib
+lib /OUT:lua5.3.5-static.lib *.obj
+link /OUT:../bin/luac5.3.exe /SUBSYSTEM:CONSOLE luac.o lua5.3.5-static.lib
+cd ../.. \ No newline at end of file
diff --git a/dist/win/deps/fltk4lua-0.1-1.rockspec b/dist/win/deps/fltk4lua-0.1-1.rockspec
new file mode 100644
index 0000000..7161c4b
--- /dev/null
+++ b/dist/win/deps/fltk4lua-0.1-1.rockspec
@@ -0,0 +1,127 @@
+package = "fltk4lua"
+version = "0.1-1"
+source = {
+ url = "gitrec+https://github.com/siffiejoe/lua-fltk4lua.git",
+ tag = "v0.1"
+}
+description = {
+ summary = "Lua binding to FLTK, the Fast Light ToolKit",
+ detailed = [[
+ Lua binding to FLTK, a C++ GUI toolkit, which allows you to
+ create GUIs from within Lua programs.
+ ]],
+ homepage = "https://github.com/siffiejoe/lua-fltk4lua/",
+ license = "MIT+LGPL"
+}
+supported_platforms = { "unix", "windows" }
+dependencies = {
+ "lua >= 5.1, < 5.4",
+ "luarocks-fetch-gitrec",
+ "luarocks-build-cpp",
+}
+external_dependencies = {
+ platforms = {
+ windows = {
+ FLTK = {
+ header = "FL/Fl",
+ library = "fltk"
+ }
+ },
+ unix = {
+ FLTK = {
+ program = "fltk-config"
+ }
+ }
+ }
+}
+build = {
+ type = "make",
+ variables = {
+ DLL_INSTALL_DIR = "$(LIBDIR)",
+ LUA_INCDIR = "$(LUA_INCDIR)",
+ FLTK_CONFIG = "$(FLTK_BINDIR)/fltk-config",
+ CXX = "g++",
+ CFLAGS = "$(CFLAGS)",
+ LIBFLAG = "$(LIBFLAG)",
+ LIB_EXTENSION = "$(LIB_EXTENSION)",
+ },
+ platforms = {
+ windows = {
+ type = "cpp",
+ modules = {
+ ["fltk4lua"] = {
+ sources = {
+ "src/fltk4lua.cxx",
+ "src/f4l_enums.cxx",
+ "src/f4l_ask.cxx",
+ "src/f4l_image.cxx",
+ "src/f4l_shared_image.cxx",
+ "src/f4l_widget.cxx",
+ "src/f4l_box.cxx",
+ "src/f4l_button.cxx",
+ "src/f4l_chart.cxx",
+ "src/f4l_clock.cxx",
+ "src/f4l_group.cxx",
+ "src/f4l_browserx.cxx",
+ "src/f4l_browser.cxx",
+ "src/f4l_file_browser.cxx",
+ "src/f4l_check_browser.cxx",
+ "src/f4l_input_choice.cxx",
+ "src/f4l_color_chooser.cxx",
+ "src/f4l_pack.cxx",
+ "src/f4l_scroll.cxx",
+ "src/f4l_spinner.cxx",
+ "src/f4l_tabs.cxx",
+ "src/f4l_tile.cxx",
+ "src/f4l_window.cxx",
+ "src/f4l_wizard.cxx",
+ "src/f4l_input.cxx",
+ "src/f4l_menu.cxx",
+ "src/f4l_choice.cxx",
+ "src/f4l_menu_bar.cxx",
+ "src/f4l_menu_button.cxx",
+ "src/f4l_progress.cxx",
+ "src/f4l_valuator.cxx",
+ "src/f4l_adjuster.cxx",
+ "src/f4l_counter.cxx",
+ "src/f4l_dial.cxx",
+ "src/f4l_roller.cxx",
+ "src/f4l_slider.cxx",
+ "src/f4l_value_input.cxx",
+ "src/f4l_value_output.cxx",
+ "moon/moon.c",
+ "compat-5.3/c-api/compat-5.3.c",
+ },
+ defines = {
+ "MOON_PREFIX=f4lx",
+ "COMPAT53_PREFIX=f4lx",
+ "WIN32",
+ "NDEBUG",
+ "_CRT_SECURE_NO_WARNINGS"
+ },
+ libraries = {
+ "fltkimages",
+ "fltkjpeg",
+ "fltkpng",
+ "fltkzlib",
+ "fltk",
+ "advapi32",
+ "comctl32",
+ "gdi32",
+ "ole32",
+ "shell32",
+ "user32",
+ "uuid",
+ },
+ incdirs = {
+ "$(FLTK_INCDIR)",
+ "moon",
+ "compat-5.3/c-api"
+ },
+ libdirs = { "$(FLTK_LIBDIR)" }
+ }
+ }
+ }
+ }
+}
+
diff --git a/dist/win/deps/osc-1.0.1-1.rockspec b/dist/win/deps/osc-1.0.1-1.rockspec
new file mode 100644
index 0000000..77c2dc0
--- /dev/null
+++ b/dist/win/deps/osc-1.0.1-1.rockspec
@@ -0,0 +1,47 @@
+package = "osc"
+version = "1.0.1-1"
+source = {
+ url = 'git://github.com/lubyk/osc',
+ tag = 'REL-1.0.1',
+ dir = 'osc',
+}
+description = {
+ summary = "OpenSoundControl for Lua with some wrappers around lens.Socket.",
+ detailed = [[
+ Simply packs/unpacks between Lua values and binary strings ready to be sent
+ on the network or other transports.
+
+ Uses Ross Bencina oscpack library.
+ ]],
+ homepage = "http://doc.lubyk.org/osc.html",
+ license = "MIT"
+}
+
+dependencies = {
+ "lua >= 5.1, < 5.4",
+ "lub >= 1.0.3, < 2.0",
+}
+build = {
+ type = 'builtin',
+ modules = {
+ -- Plain Lua files
+ ['osc' ] = 'osc/init.lua',
+ ['osc.Client' ] = 'osc/Client.lua',
+ ['osc.Server' ] = 'osc/Server.lua',
+ -- C module
+ ['osc.core' ] = {
+ defines = {'OSC_HOST_LITTLE_ENDIAN'},
+ sources = {
+ 'src/bind/dub/dub.cpp',
+ 'src/bind/osc_core.cpp',
+ 'src/osc.cpp',
+ 'src/vendor/osc/OscOutboundPacketStream.cpp',
+ 'src/vendor/osc/OscPrintReceivedElements.cpp',
+ 'src/vendor/osc/OscReceivedElements.cpp',
+ 'src/vendor/osc/OscTypes.cpp',
+ },
+ incdirs = {'include', 'src/bind', 'src/vendor'},
+ },
+ },
+}
+
diff --git a/dist/win/deps/wlua.c b/dist/win/deps/wlua.c
new file mode 100644
index 0000000..7e3045f
--- /dev/null
+++ b/dist/win/deps/wlua.c
@@ -0,0 +1,16 @@
+#include <windows.h>
+#include <stdlib.h> /* declaration of __argc and __argv */
+
+extern int main(int, char **);
+
+int PASCAL WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int ncmdshow)
+{
+ int rc;
+
+ extern int __argc; /* this seems to work for all the compilers we tested, except Watcom compilers */
+ extern char** __argv;
+
+ rc = main(__argc, __argv);
+
+ return rc;
+}
diff --git a/dist/win/fix-paths.sh b/dist/win/fix-paths.sh
new file mode 100644
index 0000000..e401c76
--- /dev/null
+++ b/dist/win/fix-paths.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+PP="$1" # "D:/alive_pkg/dist/$1/lua/"
+PR=${PP//\//\\\\}\\\\?
+
+echo "replacing '$PP' / '$PR' with relative paths"
+
+for script in "dist/$2/lua/bin/"*.bat; do
+ echo "fixing '$script'..."
+ head -n 2 "$script" > "$script.nu"
+ cat <<EOF >> "$script.nu"
+set PR=%~dp0..\\
+set PP=%PR:\\=/%
+EOF
+
+ case "$(basename "$script" .bat)" in
+ alv-fltk|alv-wx)
+ tail -n 2 "$script" | \
+ sed -r "s|${PR}|%PR%|g" | \
+ sed -r "s|${PP}|%PP%|g" | \
+ sed 's|"%PR%bin\\lua5.3.exe"|start "Lua" "%PR%bin\\wlua5.3.exe"|' \
+ >> "$script.nu"
+ ;;
+ *)
+ tail -n 2 "$script" | \
+ sed -r "s|${PR}|%PR%|g" | \
+ sed -r "s|${PP}|%PP%|g" \
+ >> "$script.nu"
+ ;;
+ esac
+ mv "$script.nu" "$script"
+done
diff --git a/dist/win/gen-readme.sh b/dist/win/gen-readme.sh
new file mode 100644
index 0000000..99aa738
--- /dev/null
+++ b/dist/win/gen-readme.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+cat <<EOF >"dist/$1/README.txt"
+alive $2
+==========
+
+https://alv.s-ol.nu
+https://github.com/s-ol/alive
+
+License
+-------
+alive is licensed under the GPLv3 free and open-source license, a copy of which
+you can find in the file \`LICENSE\`.
+
+This binary distribution of alive contains the Lua interpreter, LuaRocks package
+manager, and a number of Lua modules licensed under various terms. Lua and
+LuaRocks are both licensed under the MIT license. The packages can be found
+within the \`lua\` directory while their individual licensing information may be
+viewed using \`luarocks.bat\`:
+
+ cmd.exe> luarocks.bat list
+ cmd.exe> luarocks.bat show moonscript
+ cmd.exe> luarocks.bat show ...
+EOF
diff --git a/dist/win/wrappers/alv-fltk.bat b/dist/win/wrappers/alv-fltk.bat
new file mode 100644
index 0000000..92a4482
--- /dev/null
+++ b/dist/win/wrappers/alv-fltk.bat
@@ -0,0 +1,3 @@
+@echo off
+%~dp0lua\bin\alv-fltk.bat %*
+exit /b %ERRORLEVEL%
diff --git a/dist/win/wrappers/alv-lib/README.txt b/dist/win/wrappers/alv-lib/README.txt
new file mode 100644
index 0000000..3680eb2
--- /dev/null
+++ b/dist/win/wrappers/alv-lib/README.txt
@@ -0,0 +1,4 @@
+You can use this directory to add extensions to alv.
+See the extension documentation here for more information:
+
+https://alv.s-ol.nu/stable/internals/topics/extensions.md.html
diff --git a/dist/win/wrappers/alv.bat b/dist/win/wrappers/alv.bat
new file mode 100644
index 0000000..2efff91
--- /dev/null
+++ b/dist/win/wrappers/alv.bat
@@ -0,0 +1,3 @@
+@echo off
+%~dp0lua\bin\alv.bat --nocolor %*
+exit /b %ERRORLEVEL%
diff --git a/dist/win/wrappers/lua/lua.bat b/dist/win/wrappers/lua/lua.bat
new file mode 100644
index 0000000..f7fefe4
--- /dev/null
+++ b/dist/win/wrappers/lua/lua.bat
@@ -0,0 +1,7 @@
+@ECHO OFF
+SETLOCAL
+SET PR=%~dp0
+SET LUAROCKS_CONFIG=%PR%luarocks.config.lua
+%PR%bin\luarocks --lua-dir %PR% --tree %PR% LUA_INCDIR=%PR%include LUA_LIBDIR=%PR%bin path > %TMP%/_luarocks_path.bat
+call %tmp%/_luarocks_path
+%PR%bin\lua5.3 %*
diff --git a/dist/win/wrappers/lua/luarocks.bat b/dist/win/wrappers/lua/luarocks.bat
new file mode 100644
index 0000000..46a8dbd
--- /dev/null
+++ b/dist/win/wrappers/lua/luarocks.bat
@@ -0,0 +1,5 @@
+@ECHO OFF
+SETLOCAL
+SET PR=%~dp0
+SET LUAROCKS_CONFIG=%PR%luarocks.config.lua
+%PR%bin\luarocks --lua-dir %PR% --tree %PR% LUA_INCDIR=%PR%include LUA_LIBDIR=%PR%bin %*
diff --git a/dist/win/wrappers/lua/luarocks.config.lua b/dist/win/wrappers/lua/luarocks.config.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dist/win/wrappers/lua/luarocks.config.lua