Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
Makefile: Take advantage of the new helpers in scripts/
Browse files Browse the repository at this point in the history
Now that we have scripts that implements `sed -i` and emulate `md5sum`
and `sha256sum` it's better to use them rather than spelling out the code
each time.
  • Loading branch information
bassosimone committed Jan 17, 2011
1 parent 1123776 commit caa8895
Showing 1 changed file with 6 additions and 47 deletions.
53 changes: 6 additions & 47 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ _install_menu:
# The original sources contain the @DATADIR@ placeholder and
# will use a sane default if they find the placeholder instead
# of a valid path.
# Note that we don't use ``sed -i`` below because at least
# in OpenBSD this non-standard switch is not implemented.
# FIXME Actually the sources contain PREFIX but it should use
# DATADIR; however now we don't have time to fix that and so
# the above comment is not (yet) right.
Expand All @@ -212,16 +210,14 @@ NEEDEDIT += $(DESTDIR)$(MENUDIR)/neubot-web-ui.desktop
#
#_install_edit:
# @for EDIT in $(NEEDEDIT); do \
# sed 's|@DATADIR@|$(DATADIR)|g' $$EDIT > $$EDIT.tmp; \
# cat $$EDIT.tmp > $$EDIT; rm $$EDIT.tmp; \
# ./scripts/sed_inplace 's|@DATADIR@|$(DATADIR)|g' $$EDIT; \
# done
#
# Old style:
#
_install_edit:
@for EDIT in $(NEEDEDIT); do \
sed 's|@PREFIX@|$(PREFIX)|g' $$EDIT > $$EDIT.tmp; \
cat $$EDIT.tmp > $$EDIT; rm $$EDIT.tmp; \
./scripts/sed_inplace 's|@PREFIX@|$(PREFIX)|g' $$EDIT; \
done

_install_compile:
Expand Down Expand Up @@ -334,36 +330,14 @@ _deb_control_skel:
install -m644 debian/$$FILE dist/$$FILE; \
done

#
# Try to be portable and don't assume we're running in the
# GNU/Linux environment where md5sum is available.
#

_deb_control_md5sums:
@install -m644 /dev/null dist/control/md5sums
@FILES=`find dist/data -type f`; \
if [ -x /usr/bin/md5sum ]; then \
for FILE in $$FILES; do \
md5sum $$FILE >> dist/control/md5sums; \
done; \
elif [ -x /bin/cksum ]; then \
for FILE in $$FILES; do \
MD5=`cat $$FILE|/bin/cksum -a md5`; \
echo $$MD5 $$FILE >> dist/control/md5sums; \
done; \
else \
echo "error: can't calculate md5sum"; \
exit 1; \
fi
@sed 's|dist\/data\/||g' dist/control/md5sums > dist/control/md5sums.1
@cat dist/control/md5sums.1 > dist/control/md5sums
@rm -rf dist/control/md5sums.1
@./scripts/md5sum `find dist/data -type f` > dist/control/md5sums
@./scripts/sed_inplace 's|dist\/data\/||g' dist/control/md5sums

_deb_control_size:
@SIZE=`du -k -s dist/data/|cut -f1` && \
sed "s|@SIZE@|$$SIZE|" dist/control/control > dist/control/siz && \
cat dist/control/siz > dist/control/control && \
rm dist/control/siz
./scripts/sed_inplace "s|@SIZE@|$$SIZE|" dist/control/control

_deb_control:
@make -f Makefile _deb_control_skel
Expand Down Expand Up @@ -431,25 +405,10 @@ lint:
# Often this command is run as root and we want to be able to
# write the win32 installer in the directory at the end of the
# Unix and MacOSX release process.
# Try to be portable because OpenBSD (for instance) does not
# have a sha256sum command.
#

_release_finish:
@cd dist && \
for FILE in neubot-*; do \
if env sha256sum < /dev/null 1> /dev/null 2> /dev/null; then \
sha256sum $$FILE >> SHA256.inc; \
test $$? || exit 1; \
elif env sha256 < /dev/null 1> /dev/null 2> /dev/null; then \
sha256 $$FILE | perl -ne \
'print "$$2 $$1\n" if /^SHA256 \((.*)\) = (.*)$$/;' \
>> SHA256.inc; \
test $$? || exit 1; \
else \
echo "Skipping the SHA256 part..."; \
fi \
done
@cd dist && ../scripts/sha256sum neubot-* >> SHA256.inc
@cd dist && chmod 644 *
@chmod 777 dist

Expand Down

0 comments on commit caa8895

Please sign in to comment.