我正在为我的libspellcheck库创建一个debian包,结果却非常麻烦。经过大量的工作,我已经能够消除除了一个致命错误之外的所有错误:
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
这是我的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
现在,我可以从错误中看到它在$ DESTDIR文件夹中创建/ usr / etc目录时遇到了问题。但是,如果我删除$ DESTDIR,它将在/目录中创建/ usr / etc,这不是我想要的。我不想重新定位我的字典文件,因为这会产生许多代码一致性等问题。必须有办法做到这一点。
答案 0 :(得分:1)
您的mkdir
命令应该有-p
参数:mkdir -p $(DESTDIR)/usr/etc/