Commits

Marcus von Appen  committed 82b5702

- Added dist target for windows builds

  • Participants
  • Parent commits ce37cf6

Comments (0)

Files changed (1)

 @ECHO OFF
 SETLOCAL
 
-IF "%SPHINXBUILD%" == "" (
-	set SPHINXBUILD=C:\Python34-x64\Scripts\sphinx-build.exe
-)
-
+SET VERSION=1.0.0
+SET NAME=dmb
+SET DISTNAME=%NAME%-%VERSION%
 
 REM Directories
 SET SRCDIR=%CD%
 SET DEPLOYDIR="%SRCDIR%\deploy"
-SET DISTDIR="%SRCDIR%\dist"
 SET DOCDIR="%SRCDIR%\doc"
 SET DOCOUTDIR=%DOCDIR%\_build
-
-SET PLATFORMS=amd64 i386
-SET OSES=windows linux freebsd netbsd openbsd
-
 REM Packages
 SET ROOTPKG=bitbucket.org/marcusva/dmb
 
-SET NAME=dmb
-SET GO=go
+IF "%SPHINXBUILD%" == "" SET SPHINXBUILD=C:\Python34-x64\Scripts\sphinx-build.exe
+IF "%GO%" == "" SET GO=go
+IF "%GOOS%" == "" (FOR /F "delims=" %%A IN ('%GO% env GOOS') DO SET GOOS=%%A)
+IF "%GOARCH%" == "" (FOR /F "delims=" %%A IN ('%GO% env GOARCH') DO SET GOARCH=%%A)
+IF "%ZIP%" == "" SET ZIP="C:\Program Files\7-zip\7z.exe"
+IF "%ZIPARGS%" == "" SET ZIPARGS="a"
+
 
 @IF "%~1" == "" GOTO :all
 @GOTO :%~1
 
 :all
-CALL :apps
+CALL :build
 GOTO :eof
 
 :run
-CALL :apps
-for %%p in (%APPS%) DO (
-	ECHO Running %%p
-	CD %DEPLOYDIR%\%%p && %%p.exe
-)
+CD %DEPLOYDIR% && %NAME%.exe
 GOTO :eof
 
-:apps
+:build
 CALL :clean
 MKDIR %DEPLOYDIR%
 ECHO Building application %NAME%
 GOTO :eof
 
 :clean
-IF EXIST %DISTDIR% RMDIR /S /Q %DISTDIR%
 IF EXIST %DEPLOYDIR% RMDIR /S /Q %DEPLOYDIR%
 IF EXIST %DOCOUTDIR%\html RMDIR /S /Q %DOCOUTDIR%\html
 GOTO :eof
 
 :dist
 CALL :clean
-MKDIR %DISTDIR%
-FOR %%B IN (%OSES%) DO (
-	FOR %%A IN (%PLATFORMS%) DO (
-		MKDIR %DISTDIR%\%%B_%%A
-		ECHO Building application %NAME% for %%B on %%A
-		SET GOOS=%%B
-		SET GOARCH=%%A
-		%GO% build -o %DISTDIR%\%%B_%%A\%NAME%.exe %ROOTPKG%
-		XCOPY %SRCDIR%\data\*.* %DISTDIR%\%%B_%%A /E /H /Q
-	)
+SET _dp=%DEPLOYDIR%
+SET DEPLOYDIR=%DEPLOYDIR%\%DISTNAME%
+CALL :build
+SET DEPLOYDIR=%_dp%
+ECHO Creating ZIP package
+ECHO ON
+CD %DEPLOYDIR% && (
+	%ZIP% %ZIPARGS% %DISTNAME%-%GOOS%_%GOARCH%.zip %DISTNAME%
 )
 GOTO :eof