1

我正在为我的 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

这是我的生成文件:

#    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,这不是我想要的。我不想重新定位我的字典文件,因为这会在代码一致性等方面产生很多问题。必须有办法做到这一点。

4

1 回答 1

1

你的mkdir命令应该有一个-p参数:mkdir -p $(DESTDIR)/usr/etc/

于 2013-04-27T20:51:51.447 回答