OpenWrt Forum Archive

Topic: Niceshaper Makefile problem

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm traying to build a niceshaper package base on this http://ww1.devel.nnd-linux.pl/nnd/pakie … r/PKGBUILD.

My Makefile is in trunk/package/niceshaper and looks like this:

# 
# Copyright (C) 2006-2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=niceshaper
PKG_VERSION:=0.5.2
PKG_RELEASE:=1

PKG_SOURCE:=niceshaper-0.5.2.tar.bz2
PKG_SOURCE_URL:http://niceshaper.jedwabny.net/files/niceshaper-0.5.2.tar.bz2
PKG_MD5SUM:=caf40370f9a7f1d4a32c6289d4b69522
PKG_CAT:=bzcat


PKG_BUILD_DIR := $(BUILD_DIR)/niceshaper-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/niceshaper
  SECTION:=utils
  CATEGORY:=Base system
  DEPENDS:=+ip +iptables-mod-imq
  TITLE:=niceshaper
  PKGARCH:=all
endef

define Package/niceshaper/description
    NiceShaper gives you dynamic traffic shaping.
endef

define Build/Configure
    sed -i 's/sfq/esfq/' niceshaper.cpp || return 1
    g++ niceshaper.cpp -o niceshaper || return 1
endef

define Package/bridge/install 
endef

$(eval $(call BuildPackage,niceshaper))

I get error

ERROR: please fix package/niceshaper/Makefile

Can someone help me with this ?

Edit your Makefile to reflect the following:

PKG_SOURCE_URL:=http://niceshaper.jedwabny.net/files

(Last edited by mazilo on 13 Sep 2009, 22:33)

This isn't the problem hmm

#
# Copyright (C) 2006-2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=niceshaper
PKG_VERSION:=0.5.2
PKG_RELEASE:=1

PKG_SOURCE:=niceshaper-0.5.2.tar.bz2
PKG_SOURCE_URL:http://niceshaper.jedwabny.net/files/
PKG_MD5SUM:=caf40370f9a7f1d4a32c6289d4b69522
PKG_CAT:=bzcat


PKG_BUILD_DIR := $(BUILD_DIR)/niceshaper-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/niceshaper
  SECTION:=utils
  CATEGORY:=Base system
  DEPENDS:=+ip +iptables-mod-imq
  TITLE:=niceshaper
  PKGARCH:=all
endef

define Package/niceshaper/description
    NiceShaper gives you dynamic traffic shaping.
endef

define Build/Configure
    sed -i 's/sfq/esfq/' niceshaper.cpp || return 1
    g++ niceshaper.cpp -o niceshaper || return 1
endef

define Package/bridge/install
endef

$(eval $(call BuildPackage,niceshaper))
[th0m4s@6930 trunk]$ make package/niceshaper/clean V=99
ERROR: please fix package/niceshaper/Makefile
Collecting package info: done
make[2]: Entering directory `/mnt/d/openwrt/trunk'
ERROR: please fix package/niceshaper/Makefile
Collecting package info: done


Your configuration changes were NOT saved.

make[2]: Leaving directory `/mnt/d/openwrt/trunk'
make[2]: *** No rule to make target `.config', needed by `/mnt/d/openwrt/trunk/staging_dir/target-_-/stamp/.target_prereq'.  Stop.
make[1]: *** [prereq] Error 2
make: *** [package/niceshaper/clean] B??d 2

Your Makefile has a missing = that causes some errors in the compilation that I had already indicated in my previous post.

Now i see that ...
Sorry and thanks.

I'm trying and trying, but still no success hmm
I'm not  a programmer so this is really hard for me hmm
Please help and tell me why this isn't working ?

include $(TOPDIR)/rules.mk 

PKG_NAME:=niceshaper
PKG_VERSION:=0.5.2
PKG_RELEASE:=1

PKG_SOURCE:=niceshaper-0.5.2.tar.bz2
PKG_SOURCE_URL:=http://niceshaper.jedwabny.net/files/
PKG_MD5SUM:=caf40370f9a7f1d4a32c6289d4b69522
PKG_CAT:=bzcat

PKG_BUILD_DIR := $(BUILD_DIR)/niceshaper-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/niceshaper
  SECTION:=utils
  CATEGORY:=Base system
  DEPENDS:=+ip +iptables-mod-imq
  URL:=http://niceshaper.jedwabny.net/
  TITLE:=niceshaper
  PKGARCH:=all
endef

define Package/niceshaper/description
    NiceShaper gives you dynamic traffic shaping.
endef

define Build/Configure
  g++ niceshaper.cpp -o niceshaper
endef

define Package/niceshaper/install
    chmod u+x niceshaper \
    mkdir $(1)etc/niceshaper \
    $(INSTALL_BIN) niceshaper $(1)/usr/local/bin/ \
    $(INSTALL_DATA) etc/niceshaper/config $(1)/etc/niceshaper/ \
    $(INSTALL_DATA) etc/niceshaper/users $(1)/etc/niceshaper/
endef

$(eval $(call BuildPackage,niceshaper))

Hi.

The commands in the configure and install sections need to be padded with a leading tab, not spaces. This is important!
All other sections (description etc.) should be padded with one or more *spaces*.

Regards,
JoW

Hi
So if i understand you good it's should look like this

include $(TOPDIR)/rules.mk

PKG_NAME:=niceshaper
PKG_VERSION:=0.5.2
PKG_RELEASE:=1

PKG_SOURCE:=niceshaper-0.5.2.tar.bz2
PKG_SOURCE_URL:=http://niceshaper.jedwabny.net/files/
PKG_MD5SUM:=caf40370f9a7f1d4a32c6289d4b69522
PKG_CAT:=bzcat

PKG_BUILD_DIR := $(BUILD_DIR)/niceshaper-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/niceshaper
 SECTION:=utils
 CATEGORY:=Base system
 DEPENDS:=+ip +iptables-mod-imq
 URL:=http://niceshaper.jedwabny.net/
 TITLE:=niceshaper
 PKGARCH:=all
endef

define Package/niceshaper/description
 NiceShaper gives you dynamic traffic shaping.
endef

define Build/Configure
    g++ niceshaper.cpp -o niceshaper
endef

define Package/niceshaper/install
    chmod u+x niceshaper \
    mkdir $(1)etc/niceshaper \
    $(INSTALL_BIN) niceshaper $(1)/usr/local/bin/ \
    $(INSTALL_DATA) etc/niceshaper/config $(1)/etc/niceshaper/ \
    $(INSTALL_DATA) etc/niceshaper/users $(1)/etc/niceshaper/
endef

$(eval $(call BuildPackage,niceshaper))

But i still can't compile this hmm

make[3]: Entering directory `/mnt/d/openwrt/trunk/package/niceshaper'
g++ niceshaper.cpp -o niceshaper
g++: niceshaper.cpp: No such file or directory
g++: no input files
make[3]: *** [/mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/.configured_] Error 1
make[3]: Leaving directory `/mnt/d/openwrt/trunk/package/niceshaper'
make[2]: *** [package/niceshaper/compile] Error 2
make[2]: Leaving directory `/mnt/d/openwrt/trunk'
make[1]: *** [/mnt/d/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/stamp/.package_compile] Error 2
make[1]: Leaving directory `/mnt/d/openwrt/trunk'
make: *** [world] B??d 2

g++: niceshaper.cpp: No such file or directory
g++: no input files

Well this is another issue now. First of all, don't use compiler commands literally, this way you would just compile it for your host system since the cross compiler is not used. Substitute "g++" with "$(TARGET_CXX)" and prefix "niceshaper.cpp" with "$(PKG_BUILD_DIR)/" to point the compiler to the file location.

Regards,
JoW

Ok now I really don't know what to do hmm

You may want to compare your Makefile file with any Makefile file found under feeds/package/* directories.

I read lots of Makefiles but still don't now how to change "g++ niceshaper.cpp -o niceshaper".
As i was saying before i'm not programmer and this is really hard for me.

$(TARGET_CXX) $(PKG_BUILD_DIR)/niceshaper.cpp -o $(PKG_BUILD_DIR)/niceshaper

Better but still no success with compiling hmm
I don't  now why but it's not decompressing in my opinion:/

make[3]: Entering directory `/mnt/d/openwrt/trunk/package/niceshaper'
mkdir -p /mnt/d/openwrt/trunk/dl
/mnt/d/openwrt/trunk/scripts/download.pl "/mnt/d/openwrt/trunk/dl" "niceshaper-0.5.2.tar.bz2" "caf40370f9a7f1d4a32c6289d4b69522" http://niceshaper.jedwabny.net/files/
--2009-09-16 12:58:36--  http://niceshaper.jedwabny.net/files/niceshaper-0.5.2.tar.bz2
Resolving niceshaper.jedwabny.net... 80.53.211.226
Connecting to niceshaper.jedwabny.net|80.53.211.226|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10490 (10K) [application/x-tar]
Saving to: `STDOUT'

100%[======================================================================================================================================================================================>] 10,490      53.7K/s   in 0.2s

2009-09-16 12:58:36 (53.7 KB/s) - `-' saved [10490/10490]

bzcat /mnt/d/openwrt/trunk/dl/niceshaper-0.5.2.tar.bz2 | /bin/tar -C /mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/.. -xf -
ls: cannot access ./patches: No such file or directory
touch /mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/.prepared_b06aeec1de10382f9fff90178dd4673e
i486-openwrt-linux-uclibc-g++ /mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/niceshaper.cpp -o /mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/niceshaper
i486-openwrt-linux-uclibc-g++: /mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/niceshaper.cpp: No such file or directory
i486-openwrt-linux-uclibc-g++: no input files
make[3]: *** [/mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/.configured_] Error 1
make[3]: Leaving directory `/mnt/d/openwrt/trunk/package/niceshaper'
make[2]: *** [package/niceshaper/compile] Error 2
make[2]: Leaving directory `/mnt/d/openwrt/trunk'
make[1]: *** [/mnt/d/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/stamp/.package_compile] Error 2
make[1]: Leaving directory `/mnt/d/openwrt/trunk'
make: *** [world] B??d 2

i486-openwrt-linux-uclibc-g++: /mnt/d/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/niceshaper-0.5.2/niceshaper.cpp: No such file or directory

Maybe the path is not fully correct. Look into the directory where niceshaper.cpp is located. Maybe it's within a subdirectory, like src/.

Something is weird because it's decompressing to "trunk/bulid_dir/" without any folder.

Finally solved big_smile

include $(TOPDIR)/rules.mk

PKG_NAME:=niceshaper
PKG_VERSION:=0.5.2
PKG_RELEASE:=1

PKG_SOURCE:=niceshaper-0.5.2.tar.bz2
PKG_SOURCE_URL:=http://niceshaper.jedwabny.net/files/
PKG_MD5SUM:=caf40370f9a7f1d4a32c6289d4b69522

include $(INCLUDE_DIR)/package.mk

define Package/niceshaper
 SECTION:=net
 CATEGORY:=Network
 DEPENDS:=+ip +iptables-mod-imq +libstdcpp
 URL:=http://niceshaper.jedwabny.net/
 TITLE:=NiceShaper
 PKGARCH:=all
endef

define Package/niceshaper/description
 NiceShaper gives you dynamic traffic shaping.
endef

define Build/Prepare
    rm -rf $(PKG_BUILD_DIR)
    mkdir -p $(PKG_BUILD_DIR)
    tar -jxvf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)/
endef

define Build/Compile
    $(TARGET_CXX) $(PKG_BUILD_DIR)/$(PKG_NAME).cpp -o  $(PKG_BUILD_DIR)/$(PKG_NAME)
endef

define Package/niceshaper/install
    $(INSTALL_DIR) $(1)/usr/local/sbin
    $(INSTALL_DIR) $(1)/etc/niceshaper
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/niceshaper $(1)/usr/local/sbin/ 
    $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/niceshaper/users $(1)/etc/niceshaper/users
    $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/niceshaper/config $(1)/etc/niceshaper/config
endef

define Package/niceshaper/postinst
echo "Configure '/etc/niceshaper/conifg' and add '/usr/local/sbin/niceshaper start' to init script"
endef

$(eval $(call BuildPackage,niceshaper))

Thanks or yours help!

(Last edited by th0m4s on 18 Sep 2009, 13:43)

The discussion might have continued from here.