buildpkg sanity checks to make sure $PWD is a source package mkdir -p tmp/dest/usr/src/_ cd tmp for file in ../* case $file in ../tmp) ;; ../*) cp -R $file dest/usr/src/_ generate control file build opk of dest: -src_-_all.opk rm -Rf dest for binpkgdir in ../*.pkg/ check Architecture field in $binpkgdir/control if Architecture == host arch or Architecture == all mkdir dest unpack or copy sources to src binpkg = substring of $binpkgdir without '../' and '.pkg' ../build $binpkg for file in * case $file in *.buildstamp) ;; *) rm -Rf $file ;; esac package 'build' file makefile one target for each binary package targets for split binary packages should all be listed in one target rule rule should simply depend on a buildstamp rule buildstamp rule should perform build/install and touch a buildstamp example target: cd src configure --prefix=/usr make make DESTDIR=../dest install maybe objcopy debug symbols from binaries strip binaries for each binary package cp or mv files listed in install file from dest to new directory generate control file build opk of new directory