I'm creating a debian package for my libspellcheck library, and it has turned out to be quite a hassle. After a lot of work, I have been able to eliminate all but one fatal error:
make[1]: Entering directory `/home/iandun/Desktop/deb-build/libspellcheck-1.15'
mkdir /home/iandun/Desktop/deb-build/libspellcheck-1.15/debian/tmp/usr/etc/
mkdir: cannot create directory `/home/iandun/Desktop/deb-build/libspellcheck-1.15/debian/tmp/usr/etc/': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/iandun/Desktop/deb-build/libspellcheck-1.15'
dh_auto_install: make -j1 install DESTDIR=/home/iandun/Desktop/deb-build/libspellcheck-1.15/debian/tmp returned exit code 2
make: *** [binary] Error 29
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
debuild: fatal error at line 1350:
dpkg-buildpackage -rfakeroot -D -us -uc failed
Here is my makefile:
# SPELLCHECK Makefile
# Copyright (C) 2013 Ian Duncan
#
# 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
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
all: libspellcheck spellcheck
spellcheck: meta.o spellcheck.o
g++ -m32 -o spellcheck spellcheck.o meta.o libspellcheck.a
libspellcheck: checker.o
ar -cvr libspellcheck.a checker.o
spellcheck.o: spellcheck.cpp
g++ -m32 -Wall -c spellcheck.cpp
meta.o: meta.cpp
g++ -m32 -Wall -c meta.cpp
checker.o: checker.cpp
g++ -m32 -Wall -c checker.cpp
clean:
rm -rf *o
install:
mkdir $(DESTDIR)/usr/etc/
cp libspellcheck.a $(DESTDIR)$(libdir)/libspellcheck.a
cp spellcheck.h $(DESTDIR)$(includedir)/spellcheck.h
cp spellcheck $(DESTDIR)$(bindir)/spellcheck
cp english.dict $(DESTDIR)/usr/etc/english.dict
chmod 777 $(DESTDIR)/usr/etc/english.dict
deinstall:
rm /usr/lib/libspellcheck.a
rm /usr/include/spellcheck.h
rm /usr/bin/spellcheck
rm /usr/etc/english.dict
rm /usr/local/man/man1/spellcheck.1.gz
Now, I can see from the error that its having trouble creating the /usr/etc directory in the $DESTDIR folder. However, if I remove $DESTDIR, it will create /usr/etc in the / directory, which is not where I want it. I do not want to have to relocate my dictionary file, because that would create a lot of problems with code consistency and such. There must be a way to do this.
Your mkdir
command should have a -p
parameter: mkdir -p $(DESTDIR)/usr/etc/