please use this attribute.

just rename your recipe "source" to "install_source" and use attribute "node['optipng']['install_method']" to install from source (instead of package)