a
    	”$a'  ã                   @   sn   d dl Z d dlmZ d dlmZ dd„ Zddd„Zeej_d	d
„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zeej_dS )é    N)ÚBuild)Úsamba_version_filec                 C   sJ   | j d  | j¡}t|| jj| j| jjjd}t|ƒ}| j	d  
|¡ dS )zprint version.h contentsr   )ÚenvÚ
is_install)ÚinputsÚsrcpathr   r   ZsrcdirÚ	generatorÚbldr   ÚstrÚoutputsÚwrite)ÚtaskÚsrcÚversionÚstring© r   úo/home/jack/SDK/ZBT-AX3000-OpenWrt-21.02/build_dir/hostpkg/samba-4.14.12/./buildtools/wafsamba/samba_patterns.pyÚwrite_version_header   s
    r   ÚVERSIONc                 C   s   | j dtd||| jd}dS )z'generate the version.h header for Sambar   Úsetup)ÚruleÚgroupÚsourceÚtargetÚalwaysN)ÚSAMBA_GENERATORr   r   )r	   r   r   Útr   r   r   ÚSAMBA_MKVERSION   s    ûr   c                 C   s.  |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d	¡ |   d
¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d ¡ |   d!¡ |   d"¡ |   d¡ |   d#¡ |   d$¡ |   d%¡ |   d&¡ |   d'¡ |   d¡ |   d(¡ |   d)¡ |   d*¡ |   d¡ |   d¡ |   d+¡ |   d¡ |   d,¡ |   d¡ |   d-¡ |   d.¡ |   d'¡ |   d¡ |   d¡ |   d/¡ |   d0¡ |   d1¡ |   d2¡ |   d3¡ |   d4¡ |   d5¡ |   d6¡ |   d7¡ |   d8¡ |   d9¡ |   d:¡ |   d;¡ |   d<¡ |   d=¡ |   d>¡ |   d?¡ |   d@¡ |   dA¡ |   d¡ dBS )Cz"write preamble for build_options.cz/*
z!   Unix SMB/CIFS implementation.
z!   Build Options for Samba Suite
z:   Copyright (C) Vance Lankhaar <vlankhaar@linux.ca> 2003
z;   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2001
Ú
zH   This program is free software; you can redistribute it and/or modify
zH   it under the terms of the GNU General Public License as published by
zE   the Free Software Foundation; either version 3 of the License, or
z'   (at your option) any later version.
zC   This program is distributed in the hope that it will be useful,
zB   but WITHOUT ANY WARRANTY; without even the implied warranty of
zA   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
z0   GNU General Public License for more details.
zE   You should have received a copy of the GNU General Public License
zH   along with this program; if not, see <http://www.gnu.org/licenses/>.
z*/
z#include "includes.h"
z!#include "dynconfig/dynconfig.h"
z!#include "lib/cluster_support.h"
zOstatic int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
z!void build_options(bool screen);
zN/****************************************************************************
z"helper function for build_options
zN****************************************************************************/
z8static int output(bool screen, const char *format, ...)
z{
z       char *ptr = NULL;
z       int ret = 0;
z       va_list ap;
z       
z       va_start(ap, format);
z(       ret = vasprintf(&ptr,format,ap);
z       va_end(ap);
z       if (screen) {
z.              d_printf("%s", ptr ? ptr : "");
z       } else {
z/              DEBUG(4,("%s", ptr ? ptr : ""));
z	       }
z       SAFE_FREE(ptr);
z       return ret;
ú}
z.options set at build time for the samba suite
z void build_options(bool screen)
z,       if ((DEBUGLEVEL < 4) && (!screen)) {
z              return;
z;       /* Output various paths to files and directories */
z$       output(screen,"\nPaths:\n");
z=       output(screen,"   SBINDIR: %s\n", get_dyn_SBINDIR());
z;       output(screen,"   BINDIR: %s\n", get_dyn_BINDIR());
zC       output(screen,"   CONFIGFILE: %s\n", get_dyn_CONFIGFILE());
zE       output(screen,"   LOGFILEBASE: %s\n", get_dyn_LOGFILEBASE());
zD       output(screen,"   LMHOSTSFILE: %s\n",get_dyn_LMHOSTSFILE());
z:       output(screen,"   LIBDIR: %s\n",get_dyn_LIBDIR());
z<       output(screen,"   DATADIR: %s\n",get_dyn_DATADIR());
zH       output(screen,"   SAMBA_DATADIR: %s\n",get_dyn_SAMBA_DATADIR());
zB       output(screen,"   MODULESDIR: %s\n",get_dyn_MODULESDIR());
z>       output(screen,"   SHLIBEXT: %s\n",get_dyn_SHLIBEXT());
z<       output(screen,"   LOCKDIR: %s\n",get_dyn_LOCKDIR());
z>       output(screen,"   STATEDIR: %s\n",get_dyn_STATEDIR());
z>       output(screen,"   CACHEDIR: %s\n",get_dyn_CACHEDIR());
z;       output(screen,"   PIDDIR: %s\n", get_dyn_PIDDIR());
zL       output(screen,"   SMB_PASSWD_FILE: %s\n",get_dyn_SMB_PASSWD_FILE());
zD       output(screen,"   PRIVATE_DIR: %s\n",get_dyn_PRIVATE_DIR());
zD       output(screen,"   BINDDNS_DIR: %s\n",get_dyn_BINDDNS_DIR());
N©r   ©Úfpr   r   r   Úwrite_build_options_header!   s¢    















































































r#   c                 C   sà   |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d	¡ |   d
¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ d S )Nz>       /* Output the sizes of the various cluster features */
z;       output(screen, "\n%s", cluster_support_features());
r   z3       /* Output the sizes of the various types */
z*       output(screen, "\nType sizes:\n");
zU       output(screen, "   sizeof(char):         %lu\n",(unsigned long)sizeof(char));
zT       output(screen, "   sizeof(int):          %lu\n",(unsigned long)sizeof(int));
zU       output(screen, "   sizeof(long):         %lu\n",(unsigned long)sizeof(long));
zZ       output(screen, "   sizeof(long long):    %lu\n",(unsigned long)sizeof(long long));
zX       output(screen, "   sizeof(uint8_t):      %lu\n",(unsigned long)sizeof(uint8_t));
zY       output(screen, "   sizeof(uint16_t):     %lu\n",(unsigned long)sizeof(uint16_t));
zY       output(screen, "   sizeof(uint32_t):     %lu\n",(unsigned long)sizeof(uint32_t));
zV       output(screen, "   sizeof(short):        %lu\n",(unsigned long)sizeof(short));
zV       output(screen, "   sizeof(void*):        %lu\n",(unsigned long)sizeof(void*));
zW       output(screen, "   sizeof(size_t):       %lu\n",(unsigned long)sizeof(size_t));
zV       output(screen, "   sizeof(off_t):        %lu\n",(unsigned long)sizeof(off_t));
zV       output(screen, "   sizeof(ino_t):        %lu\n",(unsigned long)sizeof(ino_t));
zV       output(screen, "   sizeof(dev_t):        %lu\n",(unsigned long)sizeof(dev_t));
z/       output(screen, "\nBuiltin modules:\n");
z9       output(screen, "   %s\n", STRING_STATIC_MODULES);
r   r    r!   r   r   r   Úwrite_build_options_footerv   s,    




















r$   c                 C   s^   |   d| ¡ |   d| ¡ t|ƒD ]*}|   d| ¡ |   d| ¡ |   d¡ q$|   d¡ d S )Nz
	/* Show %s */
z#       output(screen, "\n%s:\n");

z
#ifdef %s
z"       output(screen, "   %s\n");
z#endif
r   )r   Úsorted)r"   ÚkeysZsectionÚkr   r   r   Úwrite_build_options_sectionŽ   s    r(   c                 C   s„  | j }g }g }g }g }g }g }tjdkr6t dd¡}ndd l}	|	 dd¡}|D ]´}
|
 d¡sj|
 d¡dkrv| |
¡ qN|
 d	¡rŒ| |
¡ qN|
 d
¡r¢| |
¡ qN|
 d¡rÎ|
 	d¡rÂ| |
¡ n
| |
¡ qN|
 d¡rò|
 
d¡}| |d ¡ qN| |
 |¡¡ qN| jd  | j ¡}t|dƒ}t|ƒ t||dƒ t||dƒ t||dƒ t||dƒ t||dƒ t||dƒ t|ƒ | ¡  dS )Ni  s   .-()s   ____r   z.-()Z____ZHAVE_UT_UT_ZUTMPZWITH_Z	HAVE_SYS_ÚHAVE_Z_HZstatic_init_ú(ÚwzSystem HeadersZHeaderszUTMP OptionszHAVE_* Definesz--with OptionszBuild Options)r   ÚsysÚ
hexversionÚbytesÚ	maketransr   Ú
startswithÚfindÚappendÚendswithÚsplitÚ	translater   ÚbldpathÚopenr#   r(   r$   Úclose)r   ÚtblZkeys_option_withZkeys_option_utmpZkeys_option_haveZkeys_header_sysZkeys_header_otherZ	keys_miscZtrans_tabler   ÚkeyÚlÚtgtÚfr   r   r   Úwrite_build_options˜   sL    







r>   c                 C   s   | j |tdg|d}dS )z$generate the bld_options.c for SambaÚdefines)r   Údep_varsr   N)r   r>   )r	   r   r   r   r   r   ÚSAMBA_BLDOPTIONSÆ   s
    ýrA   )r   )r,   Úwaflibr   Úwafsambar   r   r   ÚBuildContextr#   r$   r(   r>   rA   r   r   r   r   Ú<module>   s   
U
.