source: wspkg/freebsd/ @ d06ffc9

Last change on this file since d06ffc9 was d06ffc9, checked in by Ting-Wei Lan <lantw44@…>, 4 years ago

freebsd: Support flavors

Flavors is a new feature of FreeBSD ports, allowing creating different
packages from the same port by specifying different flavor values.
Python ports have been converted to use flavors, enabling us to have
both Python 2 and 3 packages installed on the workstation.

This change also means that the path of a port is no longer a unique
identifier. To specify a dependency in a port, we need both the path and
the flavor. The output file FREEBSD_OUT_PORTS, or freebsd.port, now have
the third column to store the flavor specified in the input file with
'@' symbol, which is the same as the symbol used in a port Makefile.
To simply the processing of the file, ports without flavors have their
third column set to '@'. This symbol is not required by the syntax, and
it can be changed to any non-alphanumeric symbols other than underscore.

Ideally we don't have to specify the flavor in the input file because
different flavors of a port produce packages with different names.
However, since the index file doesn't have a field for flavor, we have
to rely on users to provide them to avoid greatly slowing down the
process of generating a meta-port Makefile.

  • Property mode set to 100755
File size: 738 bytes
4: ${ports_file:="freebsd.ports"}
6count=`wc -l < "${ports_file}"`
7tr '/' '_' < "${ports_file}" | paste "${ports_file}" - | (
8        index=1
9        while read -r pkg_name pkg_ports pkg_flavor unused pkg_ports_var unused; do
10                if [ "${pkg_flavor}" != "@" ]; then
11                        pkg_ports_var="${pkg_ports_var}_${pkg_flavor}"
12                        pkg_ports="${pkg_ports} FLAVOR=${pkg_flavor}"
13                fi
14                printf 'WSPKG_PACKAGE_NAME_%-40s != printf "\\\\r===> Generating package names (%5d/%5d)" 1>\\&2; $(MAKE) -C ${PORTSDIR}/%-48s -V PKGNAMEPREFIX -V PORTNAME -V PKGNAMESUFFIX \\| tr -d "\\\\n"%%' \
15                        "${pkg_ports_var}" "${index}" "${count}" "${pkg_ports}"
16                index=$(( ${index} + 1 ))
17        done )
18printf 'WSPKG_PACKAGE_NAME_%-25s != echo 1>\\&2; echo %%' "NULL"
Note: See TracBrowser for help on using the repository browser.