Annotation of pkgsrc/lang/python311/Makefile, revision 1.4

1.4     ! wiz         1: # $NetBSD: Makefile,v 1.3 2023/01/14 17:22:25 wiz Exp $
1.1       adam        2: 
                      3: .include "dist.mk"
                      4: 
                      5: PKGNAME=       python311-${PY_DISTVERSION}
                      6: CATEGORIES=    lang python
                      7: 
                      8: MAINTAINER=    pkgsrc-users@NetBSD.org
                      9: HOMEPAGE=      https://www.python.org/
                     10: COMMENT=       Interpreted, interactive, object-oriented programming language
                     11: LICENSE=       python-software-foundation
                     12: 
                     13: CONFLICTS+=    python-[0-9]*
                     14: 
                     15: PLIST_AWK=             -f ${PKGSRCDIR}/lang/python/plist-python.awk
                     16: PLIST_AWK_ENV+=                PYVERS=311
                     17: PRINT_PLIST_AWK+=      /^[^@]/ && /[^\/]+\.pyc$$/ {
                     18: PRINT_PLIST_AWK+=      sub(/__pycache__\//, "")
                     19: PRINT_PLIST_AWK+=      sub(/\.cpython-311/, "")}
                     20: PRINT_PLIST_AWK+=      /^[^@]/ && /[^\/]+\.opt-1.pyc$$/ {
                     21: PRINT_PLIST_AWK+=      sub(/.opt-[12].pyc$$/, ".pyo")}
                     22: 
                     23: USE_LANGUAGES=         c c++
                     24: USE_TOOLS+=            pkg-config
                     25: GNU_CONFIGURE=         yes
                     26: CONFIGURE_ARGS+=       --enable-shared
                     27: CONFIGURE_ARGS+=       --with-openssl=${BUILDLINK_PREFIX.openssl}
                     28: CONFIGURE_ARGS+=       --with-system-ffi
                     29: CONFIGURE_ARGS+=       --without-ensurepip
                     30: CONFIGURE_ENV+=                OPT=${CFLAGS:M*:Q}
                     31: CONFIGURE_ENV+=                ac_cv_path_mkdir=${TOOLS_PATH.mkdir}
                     32: PKGCONFIG_OVERRIDE+=   Misc/python.pc.in Misc/python-embed.pc.in
                     33: 
                     34: PTHREAD_OPTS+= require
                     35: .include "../../mk/pthread.buildlink3.mk"
                     36: 
                     37: .include "../../mk/bsd.prefs.mk"
                     38: 
1.4     ! wiz        39: .if ${USE_CROSS_COMPILE:U:tl} == yes
1.1       adam       40: TOOL_DEPENDS+=         ${PKGNAME}:../../${PKGPATH}
                     41: # XXX copied from ../../lang/python/pyversion.mk to avoid including it
                     42: # XXX should use NATIVE_PREFIX but we don't have that
                     43: CONFIGURE_ARGS+=       PYTHON_FOR_BUILD=${PREFIX}/bin/python3.11
                     44: CONFIGURE_ARGS+=       MACHDEP=${PY_PLATNAME}
                     45: CONFIGURE_ARGS+=       \
                     46:        _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH}
                     47: CONFIGURE_ARGS+=       ac_sys_system=${OPSYS}
                     48: .  if ${OPSYS} == "OSF1"
                     49: CONFIGURE_ARGS+=       ac_cv_buggy_getaddrinfo=true
                     50: .  else
                     51: CONFIGURE_ARGS+=       ac_cv_buggy_getaddrinfo=false
                     52: .  endif
                     53: CONFIGURE_ARGS.NetBSD+=        ac_cv_file__dev_ptmx=yes
                     54: CONFIGURE_ARGS.NetBSD+=        ac_cv_file__dev_ptc=no
                     55: MAKE_ENV+=             \
                     56:        _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH}
                     57: MAKE_ENV+=             _PYTHON_PROJECT_BASE=${WRKSRC}
                     58: .endif
                     59: 
                     60: # http://bugs.python.org/issue13241
                     61: .if !empty(MACHINE_PLATFORM:MDarwin-1[12].*)
                     62: PKGSRC_COMPILER=       clang
                     63: PKG_CC=                        clang
                     64: PKG_CXX=               clang++
                     65: .endif
                     66: 
                     67: # Used in socketmodule.c to determine if a sethostname declaration is required
                     68: CFLAGS.SunOS+=         -DPKGSRC_OPSYS_VERSION=${OPSYS_VERSION}
                     69: LIBS.SunOS+=           -lrt    # fdatasync()
                     70: LIBS.SunOS+=           -luuid
                     71: .if ${OPSYS} == "SunOS" && ${OPSYS_VERSION} < 051100
                     72: SUBST_CLASSES+=                setup
                     73: SUBST_MESSAGE.setup=   Replacing crypt with crypt_i
                     74: SUBST_STAGE.setup=     pre-configure
                     75: SUBST_FILES.setup=     setup.py
                     76: SUBST_SED.setup=       -e "s,'crypt','crypt_i',"
                     77: .endif
                     78: 
                     79: PY_VER_SUFFIX=         3.11
                     80: 
                     81: .if ${OPSYS} == "Darwin"
                     82: PY_PLATNAME=   ${LOWER_OPSYS}
                     83: USE_TOOLS+=    gmake
                     84: .elif ${OPSYS} == "IRIX"
                     85: PY_PLATNAME=   ${LOWER_OPSYS:C/\..*//}
                     86: .elif ${OPSYS} == "SunOS"
                     87: PY_PLATNAME=   sunos${OS_VERSION:C/\..*//}
                     88: .elif ${OPSYS} == "HPUX"
                     89: PY_PLATNAME=   hp-ux11
                     90: .elif ${OPSYS} == "Linux"
                     91: PY_PLATNAME=   linux
                     92: .else
                     93: PY_PLATNAME=   ${LOWER_OPSYS}${OS_VERSION:C/\..*//}
                     94: .endif
                     95: PLIST_SUBST+=  PY_PLATNAME=${PY_PLATNAME:Q}
                     96: 
                     97: # For Xcode 5 and up, we need to search the SDK path for headers, otherwise
                     98: # certain modules will not be built.
                     99: .if ${OPSYS} == "Darwin" && exists(${OSX_SDK_PATH:Q}/usr/include)
                    100: CFLAGS+=       -I${OSX_SDK_PATH:Q}/usr/include
                    101: .endif
                    102: 
1.2       jperkin   103: LDFLAGS.SunOS+=        -lresolv
                    104: 
1.1       adam      105: PLIST_VARS+=   nis
                    106: .for incdir in ${_OPSYS_INCLUDE_DIRS}
                    107: .  if (exists(${incdir}/rpc/rpc.h) || exists(${incdir}/tirpc/rpc/rpc.h))
                    108: HAVE_RPC_H=    yes
                    109: .  endif
                    110: .  if (exists(${incdir}/rpcsvc/yp_prot.h) || exists(${incdir}/nsl/rpcsvc/yp_prot.h))
                    111: HAVE_YP_PROT_H=        yes
                    112: .  endif
                    113: .endfor
                    114: .if (${HAVE_RPC_H:Uno} == yes && ${HAVE_YP_PROT_H:Uno} == yes)
                    115: PLIST.nis=     yes
                    116: .endif
                    117: 
                    118: PLIST_SUBST+=  PY_VER_SUFFIX=${PY_VER_SUFFIX:Q}
                    119: 
                    120: PRINT_PLIST_AWK+=      { gsub(/${PY_PLATNAME}/, "$${PY_PLATNAME}") }
                    121: PRINT_PLIST_AWK+=      { gsub(/python${PY_VER_SUFFIX}/, \
                    122:                                "python$${PY_VER_SUFFIX}") }
                    123: 
                    124: TEST_TARGET=   test
                    125: INSTALL_TARGET=        altinstall
                    126: 
                    127: REPLACE_INTERPRETER+=  python
                    128: REPLACE.python.old=    .*python[^ ]*
                    129: REPLACE.python.new=    ${PREFIX}/bin/python${PY_VER_SUFFIX}
                    130: REPLACE_FILES.python+= Lib/base64.py
                    131: REPLACE_FILES.python+= Lib/cProfile.py
                    132: REPLACE_FILES.python+= Lib/cgi.py
                    133: REPLACE_FILES.python+= Lib/encodings/rot_13.py
                    134: REPLACE_FILES.python+= Lib/idlelib/pyshell.py
                    135: REPLACE_FILES.python+= Lib/lib2to3/pgen2/token.py
                    136: REPLACE_FILES.python+= Lib/lib2to3/tests/data/different_encoding.py
                    137: REPLACE_FILES.python+= Lib/lib2to3/tests/data/false_encoding.py
                    138: REPLACE_FILES.python+= Lib/lib2to3/tests/pytree_idempotency.py
                    139: REPLACE_FILES.python+= Lib/pdb.py
                    140: REPLACE_FILES.python+= Lib/platform.py
                    141: REPLACE_FILES.python+= Lib/profile.py
                    142: REPLACE_FILES.python+= Lib/pydoc.py
                    143: REPLACE_FILES.python+= Lib/quopri.py
                    144: REPLACE_FILES.python+= Lib/smtpd.py
                    145: REPLACE_FILES.python+= Lib/smtplib.py
                    146: REPLACE_FILES.python+= Lib/tabnanny.py
                    147: REPLACE_FILES.python+= Lib/tarfile.py
                    148: REPLACE_FILES.python+= Lib/test/bisect_cmd.py
                    149: REPLACE_FILES.python+= Lib/test/crashers/recursive_call.py
                    150: REPLACE_FILES.python+= Lib/test/curses_tests.py
                    151: REPLACE_FILES.python+= Lib/test/re_tests.py
                    152: REPLACE_FILES.python+= Lib/test/regrtest.py
                    153: REPLACE_FILES.python+= Lib/timeit.py
                    154: REPLACE_FILES.python+= Lib/trace.py
                    155: REPLACE_FILES.python+= Lib/turtledemo/__main__.py
                    156: REPLACE_FILES.python+= Lib/turtledemo/bytedesign.py
                    157: REPLACE_FILES.python+= Lib/turtledemo/clock.py
                    158: REPLACE_FILES.python+= Lib/turtledemo/forest.py
                    159: REPLACE_FILES.python+= Lib/turtledemo/fractalcurves.py
                    160: REPLACE_FILES.python+= Lib/turtledemo/lindenmayer.py
                    161: REPLACE_FILES.python+= Lib/turtledemo/minimal_hanoi.py
                    162: REPLACE_FILES.python+= Lib/turtledemo/paint.py
                    163: REPLACE_FILES.python+= Lib/turtledemo/peace.py
                    164: REPLACE_FILES.python+= Lib/turtledemo/penrose.py
                    165: REPLACE_FILES.python+= Lib/turtledemo/planet_and_moon.py
                    166: REPLACE_FILES.python+= Lib/turtledemo/sorting_animate.py
                    167: REPLACE_FILES.python+= Lib/turtledemo/tree.py
                    168: REPLACE_FILES.python+= Lib/turtledemo/yinyang.py
                    169: REPLACE_FILES.python+= Lib/uu.py
                    170: REPLACE_FILES.python+= Lib/webbrowser.py
                    171: 
                    172: # XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib
                    173: # Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));'
                    174: SUBST_CLASSES+=                findlib
                    175: SUBST_MESSAGE.findlib= Fixing find_library().
                    176: SUBST_STAGE.findlib=   pre-configure
                    177: SUBST_FILES.findlib=   Lib/ctypes/macholib/dyld.py
                    178: SUBST_FILES.findlib+=  Lib/ctypes/util.py
                    179: SUBST_FILES.findlib+=  Lib/distutils/unixccompiler.py
                    180: SUBST_SED.findlib=     -e 's,/usr/local,${PREFIX},'
                    181: SUBST_SED.findlib+=    -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!"
                    182: SUBST_NOOP_OK.findlib= yes
                    183: 
                    184: SUBST_CLASSES+=                pkgversion
                    185: SUBST_STAGE.pkgversion=        pre-configure
                    186: SUBST_FILES.pkgversion=        Lib/lib2to3/pgen2/driver.py
                    187: SUBST_VARS.pkgversion= PKGVERSION_NOREV
                    188: 
                    189: .include "options.mk"
                    190: 
                    191: CHECK_INTERPRETER_SKIP=                lib/python${PY_VER_SUFFIX}/venv/scripts/posix/pydoc
                    192: CHECK_INTERPRETER_SKIP+=       lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_z64
                    193: CHECK_INTERPRETER_SKIP+=       lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_zip
                    194: CHECK_INTERPRETER_SKIP+=       lib/python${PY_VER_SUFFIX}/test/ziptestdata/header.sh
                    195: 
                    196: # contain CONFIGURE_ARGS and CONFIGURE_ENV
                    197: CHECK_WRKREF_SKIP+=    lib/python${PY_VER_SUFFIX}/_sysconfigdata*
                    198: CHECK_WRKREF_SKIP+=    lib/python${PY_VER_SUFFIX}/__pycache__/_sysconfigdata*
                    199: CHECK_WRKREF_SKIP+=    lib/python${PY_VER_SUFFIX}/config-${PY_VER_SUFFIX}/Makefile
                    200: 
                    201: # Avoid error: Cannot generate ./Include/opcode.h, python not found !
                    202: post-configure:
                    203:        touch ${WRKSRC}/Include/opcode.h
                    204: 
                    205: .if ${OPSYS} == "HPUX"
                    206: post-install: hpux-postinstall
                    207: .PHONY: hpux-postinstall
                    208: hpux-postinstall:
                    209:        ${LN} -fs ${DESTDIR}${PREFIX}/lib/libpython3.11.sl \
                    210:                ${DESTDIR}${PREFIX}/lib/libpython3.11.sl.1.0
                    211: .endif
                    212: 
                    213: INSTALLATION_DIRS+=    lib/python${PY_VER_SUFFIX}/site-packages
                    214: 
                    215: pre-install: setuptools-preinstall
                    216: .PHONY: setuptools-preinstall
                    217: setuptools-preinstall:
                    218:        ${INSTALL_DATA} ${.CURDIR}/../../devel/py-setuptools/files/_distutils_system_mod \
                    219:                ${DESTDIR}${PREFIX}/lib/python${PY_VER_SUFFIX}/site-packages/_distutils_system_mod.py
                    220: 
                    221: # needed to make devel/py-readline pick up the correct readline implementation
                    222: BUILDLINK_DEPMETHOD.readline=          build
                    223: 
                    224: .include "../../archivers/bzip2/buildlink3.mk"
                    225: .include "../../archivers/xz/buildlink3.mk"
                    226: .include "../../devel/gettext-lib/buildlink3.mk"
                    227: .include "../../devel/libffi/buildlink3.mk"
                    228: .include "../../devel/libuuid/buildlink3.mk"
                    229: .include "../../devel/readline/buildlink3.mk"
                    230: .include "../../devel/zlib/buildlink3.mk"
                    231: .include "../../security/openssl/buildlink3.mk"
                    232: .include "../../mk/bdb.buildlink3.mk"
                    233: .include "../../mk/dlopen.buildlink3.mk"
                    234: .include "../../mk/oss.buildlink3.mk"
                    235: .include "../../mk/bsd.pkg.mk"

CVSweb <webmaster@jp.NetBSD.org>