summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <Colomar.6.4.3@GMail.com>2018-09-02 22:54:24 +0200
committerGitHub <noreply@github.com>2018-09-02 22:54:24 +0200
commit906ea528dc5092e451dcbe4e50422811a4e2dfdc (patch)
treef95bfc75699a01fb7acfdf23e969eb07ebe4d943
parent1a9e528892b29eb57614ead716de9bae58dbc585 (diff)
parent03ad2467a437d24a95ba49c715e008c47240d630 (diff)
Merge pull request #49 from AlejandroColomar/3-b5
V 3~b5
-rw-r--r--COPYING.txt5
-rw-r--r--Makefile78
-rw-r--r--SETUP.cmd24
-rw-r--r--UNINSTALL.cmd5
-rw-r--r--debian/changelog4
-rw-r--r--debian/control17
-rw-r--r--debian/copyright22
-rw-r--r--debian/rules1
-rw-r--r--modules/save/src/save.c4
-rw-r--r--share/COPYRIGHT.txt2
-rw-r--r--share/HELP.txt16
-rw-r--r--share/LICENSE.txt2
-rw-r--r--share/README.txt12
-rw-r--r--share/USAGE.txt4
14 files changed, 127 insertions, 69 deletions
diff --git a/COPYING.txt b/COPYING.txt
index a6eb0fa..81c77e6 100644
--- a/COPYING.txt
+++ b/COPYING.txt
@@ -1,14 +1,11 @@
NOTE! The GPL below is copyrighted by the Free Software
- Foundation, but the instance of code that it refers to (mine_sweeper)
+ Foundation, but the instance of code that it refers to (mine-sweeper)
is copyrighted by me who actually wrote it.
Also note that the only valid version of the GPL is _this_ particular
version of the license (ie v2, not v2.2 or v3.x or whatever), unless
explicitly otherwise stated.
- Also note that the code is copyrighted by me, but the original game,
- Mine, was written in 1990 by Robert Donner & Curt Johnson at Duff Software.
-
Alejandro Colomar
----------------------------------------
diff --git a/Makefile b/Makefile
index 2359e5b..3732ba8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
-# License: GPL-2.0
-# This Makefile has parts of the linux kernel Makefile code.
+#!/usr/bin/make -f
+
VERSION = 3
-PATCHLEVEL = b
-SUBLEVEL = 4
+PATCHLEVEL = ~b4
+SUBLEVEL =
EXTRAVERSION =
NAME = instalable
@@ -11,6 +11,12 @@ export PATCHLEVEL
export SUBLEVEL
################################################################################
+# *AUTHOR*
+
+# EMAIL "1903716@gmail.com"
+# FULL NAME "Alejandro Colomar Andrés"
+
+################################################################################
# *DOCUMENTATION*
# To see a list of typical targets execute "make help"
# More info can be located in ./README.txt
@@ -18,24 +24,12 @@ export SUBLEVEL
# expect to learn how to build mine_sweeper reading this file.
################################################################################
-# Beautify output FIXME
+# Beautify output
# ---------------------------------------------------------------------------
-#
-# Normally, we echo the whole command before executing it. We now
-# have the possibility to choose other forms of output instead, e.g.
-#
-# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
-# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
-#
-# If $(Q) is empty, the whole command will be printed.
-# If it is set to "quiet_", only the short version will be printed.
-# If it is set to "silent_", nothing will be printed at all, since
-# the variable $(silent_cmd_cc_o_c) doesn't exist.
-#
-# A simple variant is to prefix commands with $(Q) - that's useful
+# Prefix commands with $(Q) - that's useful
# for commands that shall be hidden in non-verbose mode.
#
-# $(Q)ln $@ :<
+# $(Q)some command here
#
# If BUILD_VERBOSE equals 0 then the above command will be hidden.
# If BUILD_VERBOSE equals 1 then the above command is displayed.
@@ -52,10 +46,8 @@ endif
ifeq ($(BUILD_VERBOSE), 1)
Q =
- QQ =
else
Q = @
- QQ =
endif
# If the user is running make -s (silent mode), suppress echoing of
@@ -63,11 +55,9 @@ endif
ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
Q = @
- QQ = @
endif
export Q
-export QQ
export BUILD_VERBOSE
################################################################################
@@ -77,7 +67,7 @@ export BUILD_VERBOSE
MAKEFLAGS += --no-print-directory
################################################################################
-PROGRAMVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
+PROGRAMVERSION = $(VERSION)$(if $(PATCHLEVEL),$(PATCHLEVEL)$(if $(SUBLEVEL),$(SUBLEVEL)))$(EXTRAVERSION)
export PROGRAMVERSION
################################################################################
@@ -103,11 +93,15 @@ export MAIN_DIR
export LIBALX_DIR
export MODULES_DIR
+# FIXME: Set local or not local when building a package
ifeq ($(OS), linux)
INSTALL_BIN_DIR = /usr/local/games/
+# INSTALL_BIN_DIR = /usr/games/
INSTALL_SHARE_DIR = /usr/local/share/
+# INSTALL_SHARE_DIR = /usr/share/
SHARE_DIR = mine-sweeper/
INSTALL_VAR_DIR = /var/local/
+# INSTALL_VAR_DIR = /var/games/
VAR_DIR = mine-sweeper/
else ifeq ($(OS), win)
INSTALL_DIR = c:/Program files (x86)/
@@ -175,7 +169,7 @@ export LIBS
# That's the default target when none is given on the command line
PHONY := all
-all: libalx modules object binary
+all: binary
PHONY += libalx
@@ -183,37 +177,39 @@ libalx:
$(Q)cd $(LIBALX_DIR) && $(MAKE) && cd ..
PHONY += modules
-modules:
+modules: libalx
$(Q)cd $(MODULES_DIR) && $(MAKE) && cd ..
PHONY += object
-object:
+object: modules libalx
$(Q)cd $(OBJ_DIR) && $(MAKE) && cd ..
PHONY += binary
-binary:
+binary: object
$(Q)cd $(BIN_DIR) && $(MAKE) && cd ..
PHONY += install
install: uninstall
+ @echo "Create $(INSTALL_BIN_DIR)/"
+ $(Q)mkdir -p $(DESTDIR)/$(INSTALL_BIN_DIR)/
@echo "Copy $(BIN_NAME)"
- $(Q)cp $(BIN_DIR)/$(BIN_NAME) $(INSTALL_BIN_DIR)/
+ $(Q)cp $(BIN_DIR)/$(BIN_NAME) $(DESTDIR)/$(INSTALL_BIN_DIR)/
@echo ""
@echo "Create $(INSTALL_SHARE_DIR)/$(SHARE_DIR)/"
- $(Q)mkdir $(INSTALL_SHARE_DIR)/$(SHARE_DIR)/
+ $(Q)mkdir -p $(DESTDIR)/$(INSTALL_SHARE_DIR)/$(SHARE_DIR)/
@echo "Copy share/*"
- $(Q)cp -r ./share/* $(INSTALL_SHARE_DIR)/$(SHARE_DIR)/
+ $(Q)cp -r ./share/* $(DESTDIR)/$(INSTALL_SHARE_DIR)/$(SHARE_DIR)/
@echo "Create $(INSTALL_VAR_DIR)/$(VAR_DIR)/"
- $(Q)mkdir $(INSTALL_VAR_DIR)/$(VAR_DIR)/
+ $(Q)mkdir -p $(DESTDIR)/$(INSTALL_VAR_DIR)/$(VAR_DIR)/
@echo "Copy var/*"
- $(Q)cp -r ./var/* $(INSTALL_VAR_DIR)/$(VAR_DIR)/
+ $(Q)cp -r ./var/* $(DESTDIR)/$(INSTALL_VAR_DIR)/$(VAR_DIR)/
@echo "Change owner"
- $(Q)chown root:games -R $(INSTALL_VAR_DIR)/$(VAR_DIR)/
+ $(Q)chown root:games -R $(DESTDIR)/$(INSTALL_VAR_DIR)/$(VAR_DIR)/
@echo "Change permissions"
- $(Q)chmod 664 -R $(INSTALL_VAR_DIR)/$(VAR_DIR)/
- $(Q)chmod +X -R $(INSTALL_VAR_DIR)/$(VAR_DIR)/
+ $(Q)chmod 664 -R $(DESTDIR)/$(INSTALL_VAR_DIR)/$(VAR_DIR)/
+ $(Q)chmod +X -R $(DESTDIR)/$(INSTALL_VAR_DIR)/$(VAR_DIR)/
@echo ""
@echo "Done"
@@ -221,9 +217,9 @@ install: uninstall
PHONY += uninstall
uninstall:
- $(Q)rm -f $(INSTALL_BIN_DIR)/$(BIN_NAME)
- $(Q)rm -f -r $(INSTALL_SHARE_DIR)/$(SHARE_DIR)/
- $(Q)rm -f -r $(INSTALL_VAR_DIR)/$(VAR_DIR)/
+ $(Q)rm -f $(DESTDIR)/$(INSTALL_BIN_DIR)/$(BIN_NAME)
+ $(Q)rm -f -r $(DESTDIR)/$(INSTALL_SHARE_DIR)/$(SHARE_DIR)/
+ $(Q)rm -f -r $(DESTDIR)/$(INSTALL_VAR_DIR)/$(VAR_DIR)/
@echo "Clean old installations"
@echo ""
@@ -249,10 +245,10 @@ help:
@echo '* modules - Build all modules'
@echo '* object - Build the main object'
@echo '* binary - Build the binary'
- @echo ' kernelversion - Output the version stored in Makefile (use with make -s)'
+ @echo ' install - Install the program into the filesystem'
+ @echo ' uninstall - Uninstall the program off the filesystem'
@echo ''
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
- @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info see the ./README file'
diff --git a/SETUP.cmd b/SETUP.cmd
index 36bdc9d..333cfe3 100644
--- a/SETUP.cmd
+++ b/SETUP.cmd
@@ -1,6 +1,6 @@
::##############################################################################
:: *DOCUMENTATION*
-:: This SETUP.bat installs mine_sweeper in MS Windows
+:: This SETUP.bat installs mine-sweeper in MS Windows
@echo off
@@ -9,13 +9,13 @@
call "%~dp0\UNINSTALL.cmd"
-mkdir "%ProgramFiles(x86)%\mine_sweeper\"
+mkdir "%ProgramFiles(x86)%\mine-sweeper\"
echo "Create %ProgramFiles(x86)%/mine-sweeper/"
-mkdir "%ProgramFiles(x86)%\mine_sweeper\bin\"
+mkdir "%ProgramFiles(x86)%\mine-sweeper\bin\"
echo "Create %ProgramFiles(x86)%/mine-sweeper/bin/"
-mkdir "%ProgramFiles(x86)%\mine_sweeper\share\"
+mkdir "%ProgramFiles(x86)%\mine-sweeper\share\"
echo "Create %ProgramFiles(x86)%/mine-sweeper/share/"
-mkdir "%ProgramFiles(x86)%\mine_sweeper\var\"
+mkdir "%ProgramFiles(x86)%\mine-sweeper\var\"
echo "Create %ProgramFiles(x86)%/mine-sweeper/var/"
echo ""
@@ -25,17 +25,27 @@ copy "%~dp0\COPYING.txt" "%ProgramFiles(x86)%\mine-sweeper"
echo "Copy COPYING.txt"
copy "%~dp0\README.txt" "%ProgramFiles(x86)%\mine-sweeper"
echo "Copy README.txt"
-copy "%~dp0\bin\mine-sweeper.exe" "%ProgramFiles(x86)%\mine-sweeper\bin"
-echo "Copy bin/mine-sweeper.exe"
robocopy "%~dp0\share" "%ProgramFiles(x86)%\mine-sweeper\share" /e
echo "Copy share/*"
robocopy "%~dp0\var" "%ProgramFiles(x86)%\mine-sweeper\var" /e
echo "Copy var/*"
+copy "%~dp0\bin\mine-sweeper.exe" "%ProgramFiles(x86)%\mine-sweeper\bin"
+echo "Copy bin/mine-sweeper.exe"
+echo ""
+
+mkdir "%userprofile%\Start Menu\Programs\mine-sweeper\"
+mklink "%userprofile%\Start Menu\Programs\mine-sweeper\mine-sweeper" "%ProgramFiles(x86)%\mine-sweeper\bin\mine-sweeper.exe"
+mklink "%userprofile%\Start Menu\Programs\mine-sweeper\UNINSTALL" "%ProgramFiles(x86)%\mine-sweeper\UNINSTALL.cmd"
+mklink "%userprofile%\Start Menu\Programs\mine-sweeper\README" "%ProgramFiles(x86)%\mine-sweeper\README.txt"
+mklink "%userprofile%\Start Menu\Programs\mine-sweeper\COPYING" "%ProgramFiles(x86)%\mine-sweeper\COPYING.txt"
+echo "Create start menu shortcuts"
echo ""
echo "Done"
echo ""
+pause
+
::##############################################################################
:: END
diff --git a/UNINSTALL.cmd b/UNINSTALL.cmd
index 3f250fb..df3a5e4 100644
--- a/UNINSTALL.cmd
+++ b/UNINSTALL.cmd
@@ -7,10 +7,13 @@
::##############################################################################
:: Uninstall
-rmdir "%ProgramFiles(x86)%\mine-sweeper\" /s /q
+rmdir "%ProgramFiles(x86)%\mine-sweeper\" /s /q
+rmdir "%userprofile%\Start Menu\Programs\mine-sweeper\" /s /q
echo "Clean old installations"
echo ""
+pause
+
::##############################################################################
:: END
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..68352a4
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,4 @@
+mine-sweeper (3~b5) unstable; urgency=low
+
+ * Initial Release.
+ * This is my first Debian package.
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..a2aa10b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,17 @@
+Source: mine-sweeper
+Maintainer: Alejandro Colomar Andrés <1903716@gmail.com>
+Uploaders: Alejandro Colomar Andrés <1903716@gmail.com>
+Section: games
+Priority: optional
+Build-Depends: libc6-dev libncursesw5-dev libtinfo-dev
+Standards-Version: 4.2.1.0
+Homepage: https://github.com/AlejandroColomar/mine-sweeper/
+
+Package: mine-sweeper
+Architecture: any
+Section: games
+Priority: optional
+Essential: no
+Depends: libc6,libncursesw5,libtinfo5
+Description: Terminal game based on 'Mine'.
+Homepage: https://github.com/AlejandroColomar/mine-sweeper/
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..c8688ed
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,22 @@
+Based on the game 'Mine', written in 1990 by
+Robert Donner & Curt Johnson at Duff Software.
+
+Check this: https://tcrf.net/Proto:Minesweeper_(Windows,_1990)
+
+----------------------------------------------------------------
+
+mine-sweeper Copyright (C) 2015 Alejandro COLOMAR ANDRES
+
+This program comes with ABSOLUTELY NO WARRANTY.
+This is free software, and you are welcome to redistribute it
+under the conditions of the GNU GPL-2; see the file COPYING.txt for details.
+
+----------------------------------------------------------------
+
+ NOTE! The only valid version of the GPL is _this_ particular
+ version of the license (ie v2, not v2.2 or v3.x or whatever), unless
+ explicitly otherwise stated.
+
+ Alejandro Colomar
+
+----------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
new file mode 100644
index 0000000..f549901
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1 @@
+#!/usr/bin/make -f
diff --git a/modules/save/src/save.c b/modules/save/src/save.c
index c828eb8..729520c 100644
--- a/modules/save/src/save.c
+++ b/modules/save/src/save.c
@@ -20,7 +20,11 @@
/* strcpy() & strcat() */
#include <string.h>
/* mkdir */
+#if defined OS_LINUX
#include <sys/stat.h>
+#elif defined OS_WIN
+ #include <direct.h>
+#endif
/* * * * * * * * * *
* * * Other * * * * * * *
diff --git a/share/COPYRIGHT.txt b/share/COPYRIGHT.txt
index bcdd5ef..f4b79da 100644
--- a/share/COPYRIGHT.txt
+++ b/share/COPYRIGHT.txt
@@ -7,7 +7,7 @@
----------------------------------------------------------------
- mine_sweeper Copyright (C) 2015 Alejandro COLOMAR ANDRES
+ mine-sweeper Copyright (C) 2015 Alejandro COLOMAR ANDRES
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
diff --git a/share/HELP.txt b/share/HELP.txt
index db2316e..def3501 100644
--- a/share/HELP.txt
+++ b/share/HELP.txt
@@ -1,4 +1,4 @@
-Usage: ./mine_sweeper [OPTION...]
+Usage: $ mine-sweeper [OPTION...]
-a, --rows=ROWS set number of rows
-b, --columns=COLS set number of columns
@@ -26,13 +26,13 @@ for any corresponding short options.
Examples:
- $ mine_sweeper
- $ mine_sweeper --version
- $ mine_sweeper --license
- $ mine_sweeper -i 1
- $ mine_sweeper -a 5 -b 15 -p 0.1
- $ mine_sweeper -a 15 -b 20 -p 0.3 -s 1 -x
- $ mine_sweeper -f ../files/saved/saved_000.mine -s 2 -x
+ $ mine-sweeper
+ $ mine-sweeper --version
+ $ mine-sweeper --license
+ $ mine-sweeper -i 1
+ $ mine-sweeper -a 5 -b 15 -p 0.1
+ $ mine-sweeper -a 15 -b 20 -p 0.3 -s 1 -x
+ $ mine-sweeper -f ../files/saved/saved_000.mine -s 2 -x
Report bugs to: 1903716@gmail.com
diff --git a/share/LICENSE.txt b/share/LICENSE.txt
index 3e7566d..81c77e6 100644
--- a/share/LICENSE.txt
+++ b/share/LICENSE.txt
@@ -1,5 +1,5 @@
NOTE! The GPL below is copyrighted by the Free Software
- Foundation, but the instance of code that it refers to (mine_sweeper)
+ Foundation, but the instance of code that it refers to (mine-sweeper)
is copyrighted by me who actually wrote it.
Also note that the only valid version of the GPL is _this_ particular
diff --git a/share/README.txt b/share/README.txt
index edf3327..a7132c9 100644
--- a/share/README.txt
+++ b/share/README.txt
@@ -4,7 +4,7 @@
* *
* Check this: https://tcrf.net/Proto:Minesweeper_(Windows,_1990) *
******************************************************************************
- * mine_sweeper Copyright (C) 2015 Alejandro Colomar Andrés *
+ * mine-sweeper Copyright (C) 2015 Alejandro Colomar Andrés *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -50,18 +50,22 @@ COMPILE:
INSTALL:
linux:
# make install
+ windows:
+ double click on SETUP.cmd
RUN:
linux:
- $ mine_sweeper
+ $ mine-sweeper
if it doesn't work:
- $ /usr/local/games/mine_sweeper
+ $ /usr/local/games/mine-sweeper
windows:
- double click on bin/mine_sweeper.exe
+ double click on bin/mine-sweeper.exe
UNINSTALL:
linux:
# make uninstall
+ windows:
+ double click on UNINSTALL.cmd
THE PROGRAM DOES:
diff --git a/share/USAGE.txt b/share/USAGE.txt
index 5ed5a99..152f108 100644
--- a/share/USAGE.txt
+++ b/share/USAGE.txt
@@ -1,8 +1,8 @@
- Usage: $ mine_sweeper [--exit] [--help] [--license] [--usage]
+ Usage: $ mine-sweeper [--exit] [--help] [--license] [--usage]
[--verbose=LEVEL] [--version]
[--rows=ROWS] [--columns=COLS] [--file=FILE]
[--iface=IFACE] [--proportion=PROPORTION]
[--rand-seed=SEED] [--start=START_MODE]
- Type '$ mine_sweeper --help' for a full description.
+ Type '$ mine-sweeper --help' for a full description.