Commit c08b2823 authored by Oskar Skog's avatar Oskar Skog

Test 0.4.5: Fix issue #16 and #17

parent ecb520f4
......@@ -14,4 +14,5 @@ anonymine-wrapper
anonymine.desktop
enginecfg.out
mkenginecfg.py
reconfigure
Makefile.vars
2016-12-16
0.4.5
* README: Corrected RAM usage.
* Makefile.static: "install" depends on "all", Makefile will be
automatically regenerated.
* configure.py:
- Write out two new files to $(builddir):
reconfigure: Run ./configure with the same arguments
Makefile.vars: Avoid running an unchanged ./configure again
- Sort the order of Makefile variables.
2016-12-15 Oskar Skog <oskar.skog.finland@gmail.com>
0.4.4
* anonymine.py, anonymine_engine.py, anonymine_fields.py, anonymine_solver.py:
......
......@@ -15,7 +15,7 @@
NAME := anonymine
NAME_C := Anonymine
DESCRIPTION = Minesweeper without guessing
VERSION := pre-0.4.5
VERSION := test-0.4.5
# Five more variables are required: sysconfdir, vargamesdir, EXECUTABLES and
# MODULES, and MODULES_OTHERVER which may be set to "non-existent".
......@@ -84,7 +84,6 @@ ALL_STAGE := "$(MAIN_STAGE)" "$(OSX_WRAPPER)" "$(OSX_INFO_PLIST)" \
"$(OSX_ICON)" "$(builddir)check.py" "$(FD_DESKTOP_STAGE)" \
"$(ENGINECFG_STAGE)" "$(builddir)mkenginecfg.py"
all : $(MAIN_STAGE) $(ENGINECFG_STAGE)
@$(info) 'Maybe building .desktop and app/bundle'
@if "$(freedesktop)"; then \
......@@ -95,25 +94,35 @@ all : $(MAIN_STAGE) $(ENGINECFG_STAGE)
fi
$(MAIN_STAGE) : $(MAIN_SRC) $(srcdir)Makefile.static
$(builddir)Makefile : $(builddir)Makefile.vars $(srcdir)Makefile.static
@$(info) 'Recreating Makefile'
@cat "$(builddir)Makefile.vars" "$(srcdir)Makefile.static" \
>"$(builddir)Makefile"
$(builddir)Makefile.vars : $(srcdir)configure $(srcdir)configure.py
@$(info) 'Reconfiguring...'
@cd "$(builddir)" && ./reconfigure
$(MAIN_STAGE) : $(MAIN_SRC) $(srcdir)Makefile.static $(builddir)Makefile
@$(info) 'Creating the appropriate shebang line'
@echo "#!`which python`" > "$(MAIN_STAGE)"
@sed -e "$(MAIN_STAGE_SED1)" "$(MAIN_SRC)" \
| sed -e "$(MAIN_STAGE_SED2)" >> "$(MAIN_STAGE)"
$(ENGINECFG_STAGE) : $(srcdir)mkenginecfg
$(ENGINECFG_STAGE) : $(srcdir)mkenginecfg $(builddir)Makefile
@$(info) 'Making enginecfg: mostly counting processors'
@"$(srcdir)mkenginecfg" "$(srcdir)" "$(builddir)" "$(HISCORE_FILE)"
build-freedesktop : FORCE
build-freedesktop : FORCE $(builddir)Makefile
@: # Refer to desktop/README for information about the following.
@"$(FD_MK_DESKTOP)" "$(FD_DESKTOP_STAGE)" $(NAME) "$(NAME_C)" \
"$(DESCRIPTION) -- version $(VERSION)"
build-macosx : FORCE
build-macosx : FORCE $(builddir)Makefile
@: # Refer to desktop/README for information about the following.
@echo '#!/bin/sh' > "$(OSX_WRAPPER)"
@echo 'open -b com.apple.terminal' "$(MAIN_DEST)" >> "$(OSX_WRAPPER)"
......@@ -123,14 +132,14 @@ build-macosx : FORCE
clean : FORCE
clean : FORCE $(builddir)Makefile
@rm $(ALL_STAGE) 2> /dev/null || true
@: # Remove the bytecode files.
@rm -- "$(srcdir)"*.pyc 2> /dev/null || true
@rm -r -- "$(srcdir)"__pycache__/ 2> /dev/null || true
distclean : clean
distclean : clean $(builddir)Makefile
@rm $(builddir)Makefile
......@@ -180,7 +189,7 @@ FD_ICON_DEST256 := $(FD_ICON_DESTDIR256)/$(NAME).png
BUNDLE := $(DESTDIR)/Applications/$(NAME_C).app
check-install-cfg : FORCE
check-install-cfg : FORCE $(builddir)Makefile
@$(PRE_INSTALL)
@: # Cause installation to fail if the configuration is incompatible.
@$(info) 'Installing or checking configuration'
......@@ -191,14 +200,14 @@ check-install-cfg : FORCE
@$(INSTALL_CFG) "$(ENGINECFG_STAGE)" "$(CFG_DIR)/enginecfg" $(verbose)
overwrite-cfg: FORCE
overwrite-cfg: FORCE $(builddir)Makefile
@$(INSTALL) -m 644 "$(srcdir)cursescfg" "$(CFG_DIR)/cursescfg"
@$(INSTALL) -m 644 "$(ENGINECFG_STAGE)" "$(CFG_DIR)/enginecfg"
@$(info) "Configuration has been overwritten"
@$(info) "All (if any) system-wide modifications are lost"
install-dirs : FORCE
install-dirs : FORCE $(builddir)Makefile
@$(info) 'Installing directories'
@mkdir -p "$(CFG_DIR)" || true
@mkdir -p "$(DESTDIR)$(vargamesdir)" || true
......@@ -218,7 +227,7 @@ install-dirs : FORCE
fi
install : check-install-cfg install-dirs
install : all check-install-cfg install-dirs $(builddir)Makefile
@$(NORMAL_INSTALL)
@: # When the configuration has been installed, install the main
@: # program, and then the modules for both versions of Python.
......@@ -263,7 +272,7 @@ install : check-install-cfg install-dirs
fi
uninstall: FORCE
uninstall: FORCE $(builddir)Makefile
@$(PRE_UNINSTALL)
@if "$(freedesktop)"; then \
xdg-desktop-menu uninstall --novendor --mode system \
......@@ -286,7 +295,7 @@ uninstall: FORCE
fi
print-destinations: FORCE
print-destinations : FORCE $(builddir)Makefile
@echo "Main program: $(MAIN_DEST)"
@echo "Engine module: $(ENGINE_DEST)"
@echo "Solver module: $(SOLVER_DEST)"
......@@ -323,17 +332,17 @@ PKG := $(NAME)-$(VERSION)
test : check
@true
check: FORCE
check : FORCE $(builddir)Makefile
@$(info) "Checking that it works on both snakes... May take a while!"
@$(srcdir)check.sh "$(srcdir)" "$(builddir)"
dist : FORCE
dist : FORCE $(builddir)Makefile
@$(info) "Building tarballs..."
@$(srcdir)mkdist "$(srcdir)" "$(builddir)" "$(PKG)"
release : dist check
release : dist check $(builddir)Makefile
@cp -t ~www-data/archive/"$(NAME)/" "$(PKG).tar.gz" \
|| echo You are not me.
@cp -t ~www-data/archive/"$(NAME)/" "$(PKG).tar.xz" \
......
......@@ -543,6 +543,9 @@ def main():
if flags['v']:
sys.stdout.write(s + '\n')
# NOTICE: `getargs` pops items from sys.argv
reconfigure_argv = sys.argv[1:]
Makefile = {
'srcdir': '', # REQUIRED
'builddir': '', # REQUIRED
......@@ -605,17 +608,52 @@ def main():
sys.stderr.write(
'There were errors; no Makefile will be written.\n')
myexit(1)
# Write Makefile.
inname = Makefile['srcdir'] + 'Makefile.static'
outname = Makefile['builddir'] + 'Makefile'
v('Writing "' + outname + '" from "' + inname + '"...')
Makefile_name = Makefile['builddir'] + 'Makefile'
Makefile_vars_name = Makefile['builddir'] + 'Makefile.vars'
v('Writing "' + Makefile_vars_name + '"...')
v('Writing "' + Makefile_name + '" from "' + inname + '"...')
Makefile_f = open(Makefile_name, 'w')
Makefile_vars_f = open(Makefile_vars_name, 'w')
for variable in sorted(Makefile):
Makefile_f.write(variable + ' = ' + Makefile[variable] + '\n')
Makefile_vars_f.write(variable + ' = ' + Makefile[variable] + '\n')
Makefile_vars_f.close()
inf = open(inname)
outf = open(outname, 'w')
for variable in Makefile:
outf.write(variable + ' = ' + Makefile[variable] + '\n')
outf.write(inf.read())
outf.close()
Makefile_f.write(inf.read())
Makefile_f.close()
inf.close()
# Write reconfigure.
def shellescape(s):
'''
"""foo""" -> """'foo'"""
"""foo'bar""" -> """'foo'"'"'bar"""
"""foo bar""" -> ""'foo bar'"""
'''
return "'" + s.replace("'", "\'\"\'\"\'") + "'"
reconfigure_name = Makefile['builddir'] + 'reconfigure'
v('Writing "' + reconfigure_name + '"...')
reconfigure_f = open(reconfigure_name, 'w')
reconfigure_f.write(
'#!/bin/sh\n'
'cd ' + shellescape(Makefile['srcdir']) + ' && ./configure'
)
for arg in reconfigure_argv:
reconfigure_f.write(' ' + shellescape(arg))
reconfigure_f.write('\n')
reconfigure_f.close()
os.system('chmod +x ' + shellescape(reconfigure_name))
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment