From patchwork Thu Apr 28 13:36:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqin Liu X-Patchwork-Id: 8970791 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7FCA09F1D3 for ; Thu, 28 Apr 2016 13:37:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C73E202F2 for ; Thu, 28 Apr 2016 13:37:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE11E2015A for ; Thu, 28 Apr 2016 13:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249AbcD1NhU (ORCPT ); Thu, 28 Apr 2016 09:37:20 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32780 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbcD1NhT (ORCPT ); Thu, 28 Apr 2016 09:37:19 -0400 Received: by mail-pa0-f49.google.com with SMTP id zm5so35885287pac.0 for ; Thu, 28 Apr 2016 06:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Y7aF/l3IyptnNkU2Pfcbtokd8w+36E4X65ZWb2ZREJY=; b=R7u6qiiT0vUzW0XFF/fzUtWes8FjvQjUFAkJ+NJtr3WmTXEB7r2zZqYxoOgkHGYEfY CY2hUF31lKUa4MaCF7hebQM3bZZepuxMdkLSEqJ2AYS/NvhtL3hpE3NfzPNONymi75Uo itDZCOM5sBERPls+uI45Tw8FhibJkymMSuVk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Y7aF/l3IyptnNkU2Pfcbtokd8w+36E4X65ZWb2ZREJY=; b=ej2VWUa/0YPSairevRYUCvsK7LU074GOgYPpMUkU+jilE5UoJBAbh0mBZ+N5g0QrqH ipe8bvhALVVJl6TuCgsyhh6+wSw6WyDO6UyPTkrIqEtrjMdM33+lXaXy+hlR/NSket+m RcFuwLBi+zdw2oA6lDIljZ0lZ7PczLW+2CCOHMTX0rTZL7ZoxNwmpb+qBE4PP4RXNP5V Ad/H1I5S08/A5VwkJDoT0LLmtvPK02kwd5EJaANqFZz57Zhgxip3Dz2fxvPIJRNsMVKT 5PUH/iiIOisGeEsZtlCXAtJKvj00tk+kTSDqi6g/WeNLqFLzRbPFMt9ucqYLk0i5MKkB N9sg== X-Gm-Message-State: AOPr4FXvZxilRTGcKb12HiJn6NJa9q701bGYPHoO3HnzZq7iqIiGJttFXYB90Ob/Q86jqQ8N X-Received: by 10.66.194.196 with SMTP id hy4mr20568712pac.43.1461850638403; Thu, 28 Apr 2016 06:37:18 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.13]) by smtp.gmail.com with ESMTPSA id n6sm15313666pfa.2.2016.04.28.06.37.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 06:37:17 -0700 (PDT) From: Yongqin Liu To: linux-wireless@vger.kernel.org, Johannes Berg , Filipe Brandenburger Cc: Yongqin Liu Subject: [PATCH 1/1] iw: Android.mk & version.sh: update for Android based compilation Date: Thu, 28 Apr 2016 21:36:59 +0800 Message-Id: <1461850619-15298-1-git-send-email-yongqin.liu@linaro.org> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP update the Android.mk file and version.sh script for Android based compilation Android.mk: the same file as the one in AOSP master tip version.sh: update to get the version information from the git repository where this file is located instead of the the current directory where it is executed, otherwise if there is .git directory in the current directory, it will get the wrong version information. And improved the version check since the tag information may not be mirrored like what AOSP does now. Change-Id: I8fa59f0e5c7ebd61b364c77fdccf8e74da2e565c Signed-off-by: Yongqin Liu --- Android.mk | 30 ++++++++++++++++++++---------- version.sh | 39 +++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/Android.mk b/Android.mk index 4a50f89..20b0432 100644 --- a/Android.mk +++ b/Android.mk @@ -1,22 +1,32 @@ LOCAL_PATH := $(call my-dir) -IW_SOURCE_DIR := $(LOCAL_PATH) include $(CLEAR_VARS) -IW_ANDROID_BUILD=y -NO_PKG_CONFIG=y -include $(LOCAL_PATH)/Makefile - -LOCAL_SRC_FILES := $(patsubst %.o,%.c,$(OBJS)) +LOCAL_SRC_FILES := \ + iw.c genl.c event.c info.c phy.c \ + interface.c ibss.c station.c survey.c util.c ocb.c \ + mesh.c mpath.c mpp.c scan.c reg.c \ + reason.c status.c connect.c link.c offch.c ps.c cqm.c \ + bitrate.c wowlan.c coalesce.c roc.c p2p.c vendor.c \ + sections.c LOCAL_CFLAGS += -DCONFIG_LIBNL20 + +# Silence some warnings for now. Needs to be fixed upstream. b/26105799 +LOCAL_CFLAGS += -Wno-unused-parameter \ + -Wno-sign-compare \ + -Wno-format +LOCAL_CLANG_CFLAGS += -Wno-enum-conversion + LOCAL_LDFLAGS := -Wl,--no-gc-sections -#LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_TAGS := eng +LOCAL_MODULE_TAGS := debug LOCAL_STATIC_LIBRARIES := libnl LOCAL_MODULE := iw -$(IW_SOURCE_DIR)/version.c: - $(IW_SOURCE_DIR)/version.sh $(IW_SOURCE_DIR)/version.c +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_GENERATED_SOURCES := $(local-generated-sources-dir)/version.c +$(LOCAL_GENERATED_SOURCES) : $(LOCAL_PATH)/version.sh + @mkdir -p $(dir $@) + $(hide) $< $@ include $(BUILD_EXECUTABLE) diff --git a/version.sh b/version.sh index 7ccd419..7f292f3 100755 --- a/version.sh +++ b/version.sh @@ -3,20 +3,35 @@ VERSION="4.3" OUT="$1" -if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then - git update-index --refresh --unmerged > /dev/null - descr=$(git describe --match=v*) +# get the absolute path for the OUT file +OUT_NAME=$(basename ${OUT}) +OUT_DIR=$(cd $(dirname ${OUT}); pwd) +OUT="${OUT_DIR}/${OUT_NAME}" - # on git builds check that the version number above - # is correct... - [ "${descr%%-*}" = "v$VERSION" ] || exit 2 +# the version check should be under the source directory +# where this script is located, instead of the currect directory +# where this script is excuted. +SRC_DIR=$(dirname $0) +SRC_DIR=$(cd ${SRC_DIR}; pwd) +cd "${SRC_DIR}" - v="${descr#v}" - if git diff-index --name-only HEAD | read dummy ; then - v="$v"-dirty - fi -else - v="$VERSION" +v="" +if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then + git update-index --refresh --unmerged > /dev/null + descr=$(git describe --match=v* 2>/dev/null) + if [ $? -eq 0 ]; then + # on git builds check that the version number above + # is correct... + if [ "${descr%%-*}" = "v$VERSION" ]; then + v="${descr#v}" + if git diff-index --name-only HEAD | read dummy ; then + v="$v"-dirty + fi + fi + fi +fi +if [ -z "${v}" ]; then + v="$VERSION" fi echo '#include "iw.h"' > "$OUT"