get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/87802/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 87802,
    "url": "https://patches.dpdk.org/api/patches/87802/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1612537472-18192-1-git-send-email-juraj.linkes@pantheon.tech/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1612537472-18192-1-git-send-email-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1612537472-18192-1-git-send-email-juraj.linkes@pantheon.tech",
    "date": "2021-02-05T15:04:32",
    "name": "[RFC,v4] build: kni cross-compilation support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ab9461fa5b88a1fe143644b0527cb680d1b9c65b",
    "submitter": {
        "id": 1626,
        "url": "https://patches.dpdk.org/api/people/1626/?format=api",
        "name": "Juraj Linkeš",
        "email": "juraj.linkes@pantheon.tech"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1612537472-18192-1-git-send-email-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 15191,
            "url": "https://patches.dpdk.org/api/series/15191/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=15191",
            "date": "2021-02-05T15:04:32",
            "name": "[RFC,v4] build: kni cross-compilation support",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/15191/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/87802/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/87802/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E6324A0524;\n\tFri,  5 Feb 2021 16:04:38 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A5DCB188A14;\n\tFri,  5 Feb 2021 16:04:38 +0100 (CET)",
            "from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20])\n by mails.dpdk.org (Postfix) with ESMTP id BF2A240682\n for <dev@dpdk.org>; Fri,  5 Feb 2021 16:04:36 +0100 (CET)",
            "from localhost (localhost [127.0.0.1])\n by lb.pantheon.sk (Postfix) with ESMTP id A446CC05A8;\n Fri,  5 Feb 2021 16:04:35 +0100 (CET)",
            "from lb.pantheon.sk ([127.0.0.1])\n by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id 64PYP_ifLUkX; Fri,  5 Feb 2021 16:04:33 +0100 (CET)",
            "from service-node1.lab.pantheon.local (unknown [46.229.239.141])\n by lb.pantheon.sk (Postfix) with ESMTP id EAFF9BFD90;\n Fri,  5 Feb 2021 16:04:32 +0100 (CET)"
        ],
        "X-Virus-Scanned": "amavisd-new at siecit.sk",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "bruce.richardson@intel.com, thomas@monjalon.net, Ruifeng.Wang@arm.com,\n Honnappa.Nagarahalli@arm.com, jerinjacobk@gmail.com,\n hemant.agrawal@nxp.com, ferruh.yigit@intel.com, aboyer@pensando.io",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Date": "Fri,  5 Feb 2021 16:04:32 +0100",
        "Message-Id": "<1612537472-18192-1-git-send-email-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1612536397-18008-1-git-send-email-juraj.linkes@pantheon.tech>",
        "References": "<1612536397-18008-1-git-send-email-juraj.linkes@pantheon.tech>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [RFC PATCH v4] build: kni cross-compilation support",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The kni linux module is using a custom target for building, which\ndoesn't take into account any cross compilation arguments. The arguments\nin question are ARCH, CROSS_COMPILE (for gcc, clang) and CC, LD (for\nclang). Get those from the cross file and pass them to the custom\ntarget.\n\nThe user supplied path may not contain the 'build' directory, such as\nwhen using cross-compiled headers, so only append that in the default\ncase (when no path is supplied in native builds) and use the unmodified\npath from the user otherwise. Also modify the install path accordingly.\n\nSigned-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>\n---\n kernel/linux/kni/meson.build |  8 ++--\n kernel/linux/meson.build     | 80 ++++++++++++++++++++++++++++++------\n 2 files changed, 71 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build\nindex 07e0c9dae7..46b71c7418 100644\n--- a/kernel/linux/kni/meson.build\n+++ b/kernel/linux/kni/meson.build\n@@ -13,7 +13,7 @@ kni_sources = files(\n custom_target('rte_kni',\n \tinput: kni_sources,\n \toutput: 'rte_kni.ko',\n-\tcommand: ['make', '-j4', '-C', kernel_dir + '/build',\n+\tcommand: ['make', '-j4', '-C', kernel_build_dir,\n \t\t'M=' + meson.current_build_dir(),\n \t\t'src=' + meson.current_source_dir(),\n \t\t'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +\n@@ -21,8 +21,8 @@ custom_target('rte_kni',\n \t\t' -I' + meson.source_root() + '/lib/librte_kni' +\n \t\t' -I' + meson.build_root() +\n \t\t' -I' + meson.current_source_dir(),\n-\t\t'modules'],\n+\t\t'modules'] + cross_args,\n \tdepends: kni_mkfile,\n-\tinstall: true,\n-\tinstall_dir: kernel_dir + '/extra/dpdk',\n+\tinstall: install,\n+\tinstall_dir: kernel_install_dir,\n \tbuild_by_default: get_option('enable_kmods'))\ndiff --git a/kernel/linux/meson.build b/kernel/linux/meson.build\nindex 5c864a4653..7acb52944f 100644\n--- a/kernel/linux/meson.build\n+++ b/kernel/linux/meson.build\n@@ -3,25 +3,79 @@\n \n subdirs = ['kni']\n \n-# if we are cross-compiling we need kernel_dir specified\n-if get_option('kernel_dir') == '' and meson.is_cross_build()\n-\terror('Need \"kernel_dir\" option for kmod compilation when cross-compiling')\n-endif\n+kernel_build_dir = get_option('kernel_dir')\n+install = not meson.is_cross_build()\n+cross_args = []\n+kernel_install_dir = ''\n \n-kernel_dir = get_option('kernel_dir')\n-if kernel_dir == ''\n-\t# use default path for native builds\n+if not meson.is_cross_build()\n+\t# native build\n \tkernel_version = run_command('uname', '-r').stdout().strip()\n-\tkernel_dir = '/lib/modules/' + kernel_version\n+\tkernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk'\n+\tif kernel_build_dir == ''\n+\t\t# use default path for native builds\n+\t\tkernel_build_dir = '/lib/modules/' + kernel_version + '/build'\n+\tendif\n+\n+\t# test running make in kernel directory, using \"make kernelversion\"\n+\tmake_returncode = run_command('make', '-sC', kernel_build_dir,\n+\t\t\t'kernelversion').returncode()\n+\tif make_returncode != 0\n+\t\terror('Cannot compile kernel modules as requested - are kernel headers installed?')\n+\tendif\n+\n+\t# DO ACTUAL MODULE BUILDING\n+\tforeach d:subdirs\n+\t\tsubdir(d)\n+\tendforeach\n+\n+\tsubdir_done()\n endif\n \n-# test running make in kernel directory, using \"make kernelversion\"\n-make_returncode = run_command('make', '-sC', kernel_dir + '/build',\n-\t\t'kernelversion').returncode()\n-if make_returncode != 0\n-\terror('Cannot compile kernel modules as requested - are kernel headers installed?')\n+# cross build\n+# if we are cross-compiling we need kernel_build_dir specified\n+if kernel_build_dir == ''\n+\terror('Need \"kernel_dir\" option for kmod compilation when cross-compiling')\n+endif\n+cross_compiler = find_program('c').path()\n+if cross_compiler.endswith('gcc')\n+\tcross_prefix = run_command([py3, '-c', 'print(\"' + cross_compiler + '\"[:-3])']).stdout().strip()\n+elif cross_compiler.endswith('clang')\n+\tcross_prefix = ''\n+\tfound_target = false\n+\t# search for '-target' and use the arg that follows\n+\t# (i.e. the value of '-target') as cross_prefix\n+\tforeach cross_c_arg : meson.get_cross_property('c_args')\n+\t\tif found_target and cross_prefix == ''\n+\t\t\tcross_prefix = cross_c_arg\n+\t\tendif\n+\t\tif cross_c_arg == '-target'\n+\t\t\tfound_target = true\n+\t\tendif\n+\tendforeach\n+\tif cross_prefix == ''\n+\t\terror('Didn\\'t find -target and its value in' +\n+\t\t      ' c_args in input cross-file.')\n+\tendif\n+\tlinker = 'lld'\n+\tforeach cross_c_link_arg : meson.get_cross_property('c_link_args')\n+\t\tif cross_c_link_arg.startswith('-fuse-ld')\n+\t\t\tlinker = cross_c_link_arg.split('=')[1]\n+\t\tendif\n+\tendforeach\n+\tcross_args += ['CC=@0@'.format(cross_compiler), 'LD=ld.@0@'.format(linker)]\n+else\n+\terror('Unsupported cross compiler: @0@'.format(cross_compiler))\n endif\n \n+cross_arch = host_machine.cpu_family()\n+if host_machine.cpu_family() == 'aarch64'\n+\tcross_arch = 'arm64'\n+endif\n+\n+cross_args += ['ARCH=@0@'.format(cross_arch),\n+\t'CROSS_COMPILE=@0@'.format(cross_prefix)]\n+\n # DO ACTUAL MODULE BUILDING\n foreach d:subdirs\n \tsubdir(d)\n",
    "prefixes": [
        "RFC",
        "v4"
    ]
}