Index: trunk/i386/libsaio/efi.h =================================================================== --- trunk/i386/libsaio/efi.h (revision 2789) +++ trunk/i386/libsaio/efi.h (revision 2790) @@ -159,6 +159,14 @@ // ACPI 3.0 Table GUID in EFI System Table #define EFI_ACPI_30_TABLE_GUID EFI_ACPI_20_TABLE_GUID +// The EFI variable GUID for the 'FirmwareFeatures' and friends. Also known as AppleFirmwareVariableGuid in other sources. +#define APPLE_FIRMWARE_VARIABLE_GUID \ + {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14 } } + +// The EFI variable GUID for the 'boot-args' variable and others. Also known as AppleNVRAMVariableGuid in other sources. +#define APPLE_NVRAM_VARIABLE_GUID \ + {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82 } } + typedef union { EFI_GUID Guid; EFI_UINT8 Raw[16]; Index: trunk/i386/libsaio/bootstruct.h =================================================================== --- trunk/i386/libsaio/bootstruct.h (revision 2789) +++ trunk/i386/libsaio/bootstruct.h (revision 2790) @@ -135,6 +135,7 @@ config_file_t smbiosConfig; // smbios.plist config_file_t helperConfig; // boot helper partition's boot.plist config_file_t ramdiskConfig; // RAMDisk.plist + config_file_t kernelConfig; // kernel.plist bool memDetect; } PrivateBootInfo_t; Index: trunk/i386/libsaio/hfs.c =================================================================== --- trunk/i386/libsaio/hfs.c (revision 2789) +++ trunk/i386/libsaio/hfs.c (revision 2790) @@ -161,7 +161,7 @@ #ifdef __i386__ CacheInit(ih, gCacheBlockSize); #endif - return 0; + return 0L; } #ifdef __i386__ @@ -256,7 +256,7 @@ verbose("HFS signature was not present.\n"); gCurrentIH = 0; - return -1; + return -1L; } gIsHFSPlus = 1; @@ -285,7 +285,7 @@ CacheInit(ih, gCacheBlockSize); } - return 0; + return 0L; } //============================================================================== @@ -324,7 +324,7 @@ if (dirID == 0) { - return -1; + return -1L; } filePath++; @@ -337,7 +337,7 @@ if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - return -1; + return -1L; } #if UNUSED @@ -345,14 +345,14 @@ // Check file owner and permissions. if (flags & (kOwnerNotRoot | kPermGroupWrite | kPermOtherWrite)) { - return -1; + return -1L; } #endif result = ReadFile(entry, &length, base, offset); if (result == -1) { - return -1; + return -1L; } getDeviceDescription(ih, devStr); @@ -480,7 +480,7 @@ if (HFSInitPartition(ih) == -1) { - return -1; + return -1L; } dirID = kHFSRootFolderID; @@ -512,7 +512,7 @@ if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { printf("HFS: Resolve path '%s' failed\n", filePath); - return -1; + return -1L; } if (gIsHFSPlus) @@ -530,7 +530,7 @@ printf("Allocation offset 0x%x\n", (unsigned long)gAllocationOffset); #endif *firstBlock = ((u_int64_t) GetExtentStart(extents, 0) * (u_int64_t) gBlockSize + gAllocationOffset) / 512ULL; - return 0; + return 0L; } @@ -579,7 +579,7 @@ { printf("ReadFile(HFS%s): Offset is too large.\n", gIsHFSPlus ? "+" : ""); - return -1; + return -1L; } if ((*length == 0) || ((offset + *length) > fileLength)) @@ -597,15 +597,15 @@ *length = ReadExtent((char *)extents, fileLength, fileID, offset, *length, (char *)base, 0); - return 0; + return 0L; } //============================================================================== static long GetCatalogEntryInfo(void * entry, long * flags, u_int32_t * time, FinderInfo * finderInfo, long * infoValid) { - u_int32_t tmpTime = 0; - long valid = 0; + u_int32_t tmpTime = 0L; + long valid = 0L; // Get information about the file. @@ -672,7 +672,7 @@ *infoValid = valid; } - return 0; + return 0L; } //============================================================================== @@ -1226,7 +1226,7 @@ static u_int32_t GetExtentSize(void * extents, u_int32_t index) { - u_int32_t size = 0; + u_int32_t size = 0L; HFSExtentDescriptor *hfsExtents = extents; HFSPlusExtentDescriptor *hfsPlusExtents = extents; Index: trunk/i386/libsaio/vbe.h =================================================================== --- trunk/i386/libsaio/vbe.h (revision 2789) +++ trunk/i386/libsaio/vbe.h (revision 2790) @@ -211,6 +211,23 @@ mode1280x1024x555 = 0x119, mode1280x1024x565 = 0x11A, mode1280x1024x888 = 0x11B, + mode1600x1200x8 = 0x11C, + mode1600x1200x1555= 0x11D, + mode1600x1200x565 = 0x11E, + mode1600x1200x888 = 0x11F, + mode320X200X8888 = 0x140, + mode640X400X8888 = 0x141, + mode640X480X8888 = 0x142, + mode800X600X8888 = 0x143, + mode1024X768X8888 = 0x144, + mode1280X1024X8888= 0x145, + mode320X200X8 = 0x146, + mode1600X1200X8888= 0x147, + mode1152X864X8 = 0x148, + mode1152X864X1555 = 0x149, + mode1152X864X565 = 0x14A, + mode1152X864X888 = 0x14B, + mode1152X864X8888 = 0x14C, modeSpecial = 0x81FF, modeEndOfList = 0xFFFF }; Index: trunk/i386/libsaio/gma.c =================================================================== --- trunk/i386/libsaio/gma.c (revision 2789) +++ trunk/i386/libsaio/gma.c (revision 2790) @@ -999,20 +999,20 @@ /* HD Graphics */ case GMA_SKYLAKE_ULT_GT1: // 1906 case GMA_SKYLAKE_ULT_GT15: // 1913 - case GMA_SKYLAKE_ULT_GT2: // 1916 * + case GMA_SKYLAKE_ULT_GT2: // 1916 case GMA_SKYLAKE_ULX_GT1: // 190E - case GMA_SKYLAKE_ULX_GT2: // 191E * - case GMA_SKYLAKE_DT_GT2: // 1912 * + case GMA_SKYLAKE_ULX_GT2: // 191E + case GMA_SKYLAKE_DT_GT2: // 1912 case GMA_SKYLAKE_1921: // 1921 - case GMA_SKYLAKE_ULT_GT3_E: // 1926 * + case GMA_SKYLAKE_ULT_GT3_E: // 1926 case GMA_SKYLAKE_ULT_GT3: // 1923 case GMA_SKYLAKE_ULT_GT3_28W: // 1927 - case GMA_SKYLAKE_DT_GT15: // 1917 * - case GMA_SKYLAKE_DT_GT1: // 1902 * + case GMA_SKYLAKE_DT_GT15: // 1917 + case GMA_SKYLAKE_DT_GT1: // 1902 case GMA_SKYLAKE_DT_GT4: // 1932 case GMA_SKYLAKE_GT4: // 193B case GMA_SKYLAKE_GT3_FE: // 192B - case GMA_SKYLAKE_GT2: // 191B * + case GMA_SKYLAKE_GT2: // 191B case GMA_SKYLAKE_192A: // 192A case GMA_SKYLAKE_SRW_GT4: // 193A case GMA_SKYLAKE_WS_GT2: // 191D Index: trunk/i386/libsaio/cpu.c =================================================================== --- trunk/i386/libsaio/cpu.c (revision 2789) +++ trunk/i386/libsaio/cpu.c (revision 2790) @@ -491,6 +491,8 @@ //case CPUID_MODEL_HASWELL_H: case CPUID_MODEL_HASWELL_ULT: case CPUID_MODEL_HASWELL_ULX: + case CPUID_MODEL_BROADWELL_HQ: + case CPUID_MODEL_SKYLAKE_S: //case CPUID_MODEL_: msr = rdmsr64(MSR_CORE_THREAD_COUNT); // 0x35 p->CPU.NoCores = (uint32_t)bitfield((uint32_t)msr, 31, 16); @@ -655,6 +657,8 @@ case CPUID_MODEL_HASWELL_ULT: case CPUID_MODEL_HASWELL_ULX: + case CPUID_MODEL_BROADWELL_HQ: + case CPUID_MODEL_SKYLAKE_S: /* --------------------------------------------------------- */ msr = rdmsr64(MSR_PLATFORM_INFO); DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0)); Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 2789) +++ trunk/i386/libsaio/disk.c (revision 2790) @@ -1800,8 +1800,13 @@ const char *val; int len; + // ProductVersion if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { + // Copy the complete value into OSFullVer + strncpy( bvr->OSFullVer, val, len ); + bvr->OSFullVer[len] = '\0'; /* null character manually added */ + // getValueForKey uses const char for val // so copy it and trim *str = '\0'; Index: trunk/i386/libsaio/saio_types.h =================================================================== --- trunk/i386/libsaio/saio_types.h (revision 2789) +++ trunk/i386/libsaio/saio_types.h (revision 2790) @@ -211,6 +211,8 @@ bool filtered; /* newFilteredBVChain() will set to TRUE */ bool visible; /* will shown in the device list */ char OSVersion[OSVERSTRLEN]; /* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductVersion' e.g. "10.10.10" - hope will not reach e.g. 111.222.333 soon:) If so, OSVERSTRLEN 9 change to 12 */ + char OSFullVer[OSVERSTRLEN]; /* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductVersion' */ + char OSBuildVer[OSVERSTRLEN];/* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductBuildVersion' */ bool OSisServer; /* 1 = OS X server , 0 = OS X client */ bool OSisInstaller; /* 1 = OS X Install partition / recovery partition , 0 = OS X Install */ Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 2789) +++ trunk/i386/libsaio/fake_efi.c (revision 2790) @@ -104,10 +104,9 @@ /* Identify ourselves as the EFI firmware vendor */ static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','3', 0}; -// Bungo -//static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */ + static EFI_UINT32 const FIRMWARE_REVISION = 0x0001000a; // got from real MBP6,1 -// Bungo + /* Default platform system_id (fix by IntVar) static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen */ @@ -651,7 +650,7 @@ { stop("Couldn't get root '/' node"); } - const char *boardid = getStringForKey("SMboardproduct", &bootInfo->smbiosConfig); + const char *boardid = getStringForKey("SMboardproduct", &bootInfo->smbiosConfig); // SMboardserial if (boardid) { DT__AddProperty(node, BOARDID_PROP, strlen(boardid)+1, (EFI_CHAR16 *)boardid); Index: trunk/i386/boot2/drivers.c =================================================================== --- trunk/i386/boot2/drivers.c (revision 2789) +++ trunk/i386/boot2/drivers.c (revision 2790) @@ -198,7 +198,9 @@ strcpy(dirSpecExtra, "rd(0,0)/Extra/"); FileLoadDrivers(dirSpecExtra, 0); } + verbose("Attempting to loading drivers from \"Extra\" repository:\n"); + // Next try to load Extra extensions from the selected root partition. strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra)); if (FileLoadDrivers(dirSpecExtra, 0) != 0) @@ -250,13 +252,18 @@ } else { - if ( MAVERICKS || YOSEMITE || ELCAPITAN ) // issue 352 + verbose("Attempting to loading drivers from standard repositories:\n"); + + if ( (gMacOSVersion[3] == '9') || ((gMacOSVersion[3] == '1') && ((gMacOSVersion[4] == '0') || gMacOSVersion[4] == '1' ) )) // issue 352 { - strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */ + verbose("\t- Third party extensions search path: /Library/Extensions\n"); + strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") mean 4096 - 9 = 4087 */ strcat(gExtensionsSpec, "Library/"); FileLoadDrivers(gExtensionsSpec, 0); } - strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") */ + + verbose("\t- Apple extensions search path: /System/Library/Extensions\n"); + strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") mean 4096 -16 = 4080 */ strcat(gExtensionsSpec, "System/Library/"); FileLoadDrivers(gExtensionsSpec, 0); } @@ -670,7 +677,7 @@ length = 0; } - if (length != -1) + if ((length != -1) && executableAddr) { // driverModuleAddr = (void *)kLoadAddr; // if (length != 0) Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 2789) +++ trunk/i386/boot2/boot.c (revision 2790) @@ -282,7 +282,7 @@ else { // Leopard prelink kernel cache file - if ( TIGER || LEOPARD ) // OSX is 10.4 or 10.5 + if ( MacOSVerCurrent >= MacOSVer2Int("10.4") && MacOSVerCurrent <= MacOSVer2Int("10.5") ) // OSX is 10.4 or 10.5 { // Reset cache name. bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64); @@ -293,7 +293,7 @@ } // Snow Leopard prelink kernel cache file - else if ( SNOW_LEOPARD ) + else if ( MacOSVerCurrent >= MacOSVer2Int("10.6") && MacOSVerCurrent < MacOSVer2Int("10.7") ) { snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); @@ -316,7 +316,7 @@ prev_time = time; } } - verbose("Kernel Cache file path (Mac OS X 10.6.X): %s\n", kernelCachePath); + verbose("Kernel Cache file path (Mac OS X 10.6): %s\n", kernelCacheFile); } closedir(cacheDir); } @@ -325,7 +325,7 @@ // Lion, Mountain Lion, Mavericks, Yosemite and El Capitan prelink kernel cache file // for 10.7 10.8 10.9 10.10 10.11 snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow); - verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCachePath); + verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCacheFile); } } Index: trunk/i386/boot2/boot.h =================================================================== --- trunk/i386/boot2/boot.h (revision 2789) +++ trunk/i386/boot2/boot.h (revision 2790) @@ -62,6 +62,7 @@ /* * Keys used in system Boot.plist */ + #define kGraphicsModeKey "Graphics Mode" #define kTextModeKey "Text Mode" #define kQuietBootKey "Quiet Boot" @@ -169,9 +170,10 @@ #define kEnableHDMIAudio "EnableHDMIAudio" /* ati.c && nvidia.c */ /* cparm: added these keys */ +#define kEnableHiDPI "EnableHiDPI" // enable High resolution display (aka Retina) /* ErmaC: added these keys */ -#define kEnableDualLink "EnableDualLink" /* ati.c && nvidia.c && gma.c*/ +#define kEnableDualLink "EnableDualLink" /* ati.c && nvidia.c && gma.c */ #define kNvidiaGeneric "NvidiaGeneric" /* nvidia.c */ #define kSkipIntelGfx "SkipIntelGfx" /* pci_setup.c */ #define kSkipNvidiaGfx "SkipNvidiaGfx" /* pci_setup.c */ @@ -185,6 +187,9 @@ #define kHDEFLayoutID "HDEFLayoutID" /* hda.c */ #define kHDAULayoutID "HDAULayoutID" /* hda.c */ +/* Pike R. Alpha: added this key */ +#define kBlackMode "BlackMode" + /* Karas: added this key */ #define kMemFullInfo "ForceFullMemInfo" /* smbios.c */ Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 2789) +++ trunk/i386/boot2/options.c (revision 2790) @@ -1314,7 +1314,7 @@ } // Save a version of mac os we're booting. - MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion); + MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSFullVer); // so copy it and trim gMacOSVersion[0] = 0; if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) Index: trunk/package/Distribution =================================================================== --- trunk/package/Distribution (revision 2789) +++ trunk/package/Distribution (revision 2790) @@ -2,79 +2,153 @@ - - + + - - - - - + + + + + - Chameleon_Package_Title + Chameleon v%CHAMELEONVERSION% r%CHAMELEONREVISION% - + function check_kernel_bool_option(key, value) + { + if ( kernelPlist && kernelPlist[ key ] ) + { + // check if the first letter (in lowercase) is the same + return kernelPlist[ key ].charAt(0).toLowerCase() == value.charAt(0).toLowerCase(); + } + return false; + } + + function check_kernel_text_option(key, value) + { + if ( kernelPlist && kernelPlist[ key ] ) + { + return kernelPlist[ key ] == value; // check if the strings are equal + } + return false; + } + + function check_kernel_list_option(key, value) + { + if ( kernelPlist && kernelPlist[ key ] ) + { + var items = kernelPlist[ key ].split(" "); + for ( var i = 0; i < items.length; i++ ) + { + if (items[i] == value) + { + return true; + } + } + } + return false; + } + + Index: trunk/package/Scripts.templates/AddKernelOption/postinstall =================================================================== --- trunk/package/Scripts.templates/AddKernelOption/postinstall (revision 0) +++ trunk/package/Scripts.templates/AddKernelOption/postinstall (revision 2790) @@ -0,0 +1,64 @@ +#!/bin/bash + +set -u + +configFile='/private/tmp/InstallConfig.plist' +v_mntptDev=$( /usr/libexec/PlistBuddy -c "Print :ramdisk" ${configFile} ) +v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' | \ + sed -e 's/^ *//' | sed -e 's/ *$//' ) + +key="@optionKey@" +value="@optionValue@" +type="@optionType@" +logName="@LOG_FILENAME@" + +# Check if target volume exists +if [[ ! -d "$v_mntpt" ]]; then + echo "$v_mntpt volume does not exist!" >&2 + exit 1 +fi + +mainLine="==============================================================================" +subLine="------------------------------------------------------------------------------" + +exec > >(tee -a "${v_mntpt}/${logName}") 2>&1 + +echo "$mainLine" +echo "Writing kernel patcher option: ${key}=${value}" + +key="${key// /\\ }" # Escape spaces +value="${value// /\\ }" # Escape spaces + +kernelPListFile="${v_mntpt}/Extra/kernel.plist" + +case "$type" in + bool|text) + /usr/libexec/PlistBuddy -c "Add :${key} string ${value}" "$kernelPListFile" + ;; + list) + current_values=$( /usr/libexec/PlistBuddy -c "Print :${key}" \ + "$kernelPListFile" 2>/dev/null ) + result=$? + current_values="${current_values// /\\ }" # Escape spaces + current_values="${current_values//\"/\\\"}" # Escape double quotes + + if [[ $result -eq 0 ]]; then + # Append our new values + if [[ "$current_values" = "" ]]; then + new_values="${value}" + else + new_values="${current_values}\ ${value}" + fi + /usr/libexec/PlistBuddy -c "Set :${key} ${new_values}" \ + "$kernelPListFile" + else + # Create a new option + new_values="${value}" + /usr/libexec/PlistBuddy -c "Add :${key} string ${new_values}" \ + "$kernelPListFile" + fi + ;; +esac + +echo "$subLine" +exit 0 Property changes on: trunk/package/Scripts.templates/AddKernelOption/postinstall ___________________________________________________________________ Added: svn:executable + * Index: trunk/package/Scripts.templates/CleanOptions/clean_bootplist.pl =================================================================== --- trunk/package/Scripts.templates/CleanOptions/clean_bootplist.pl (revision 2789) +++ trunk/package/Scripts.templates/CleanOptions/clean_bootplist.pl (revision 2790) @@ -4,18 +4,22 @@ use YAML::Syck; our $target_volume; -our $boot_plist_filepath; +our $config_file; +our $plist_filepath; + + our $yaml_file="@YAML_FILE@"; -if ($#ARGV < 0) { - print stderr "A target volume is needed\n"; +if ($#ARGV < 1) { + print stderr "A target volume and the plist file are needed\n"; } else { - $target_volume=$ARGV[0]; + $target_volume=$ARGV[0]; + $config_file=$ARGV[1]; } -$boot_plist_filepath = "${target_volume}/Extra/org.chameleon.Boot.plist"; -if ( -f "$boot_plist_filepath" ) { +$plist_filepath = "${target_volume}/Extra/${config_file}"; +if ( -f "$plist_filepath" ) { main("$yaml_file"); } @@ -27,7 +31,7 @@ $value =~ s/([\s"])/\\$1/g; # Escape characters in value (space & ") my $plistbuddy_command="$cmd :$key $value"; - open ( OUTPUT, "-|", '/usr/libexec/PlistBuddy', "-c", "$plistbuddy_command", "$boot_plist_filepath" ); + open ( OUTPUT, "-|", '/usr/libexec/PlistBuddy', "-c", "$plistbuddy_command", "$plist_filepath" ); my $exit_code = $?; chomp($out = ); close OUTPUT; Index: trunk/package/OptionalSettings/IntelSkl.txt =================================================================== --- trunk/package/OptionalSettings/IntelSkl.txt (revision 0) +++ trunk/package/OptionalSettings/IntelSkl.txt (revision 2790) @@ -0,0 +1,39 @@ +# --------------------------------------------- +# Chameleon Optional Settings List. +# --------------------------------------------- +# Add boot options or kernel flags to the bottom of this file. +# They will appear under the package installer's Settings menu +# in a sub menu named with the filename of this file. +# Use one file or many files - it's flexible to make it easy +# to group different options under separate sub menus. +# --------------------------------------------- +# To add boot option: Structure is: +# type@name:key=value +# example1: Bool@InstantMenu:Instant Menu=Yes +# example2: Text@1024x600x32:Graphics Mode=1024x600x32 +# example3: List@Npci:Kernel Flags=npci=0x2000 +# --------------------------------------------- +# type can be: Bool, Text or List +# --------------------------------------------- +# The package installer has a setting which controls what +# the user is allowed to choose. +# A) User can select every option from the list. +# B) User can select only one of the options from the list. +# Set Exclusive=False for A, or Exclusive=True for B. +# +Exclusive=True +# --------------------------------------------- +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Text@IntelSkylakex00:IntelSklFB=0 +Text@IntelSkylakex01:IntelSklFB=1 +Text@IntelSkylakex02:IntelSklFB=2 +Text@IntelSkylakex03:IntelSklFB=3 +Text@IntelSkylakex04:IntelSklFB=4 +Text@IntelSkylakex05:IntelSklFB=5 +Text@IntelSkylakex06:IntelSklFB=6 +Text@IntelSkylakex07:IntelSklFB=7 +Text@IntelSkylakex08:IntelSklFB=8 +Text@IntelSkylakex09:IntelSklFB=9 +Text@IntelSkylakex10:IntelSklFB=10 +Text@IntelSkylakex11:IntelSklFB=11 Index: trunk/package/OptionalSettings/CrsActiveConfig.txt =================================================================== --- trunk/package/OptionalSettings/CrsActiveConfig.txt (revision 0) +++ trunk/package/OptionalSettings/CrsActiveConfig.txt (revision 2790) @@ -0,0 +1,35 @@ +# --------------------------------------------- +# Chameleon Optional Settings List. +# --------------------------------------------- +# Add boot options or kernel flags to the bottom of this file. +# They will appear under the package installer's Settings menu +# in a sub menu named with the filename of this file. +# Use one file or many files - it's flexible to make it easy +# to group different options under separate sub menus. +# --------------------------------------------- +# To add boot option: Structure is: +# type@name:key=value +# example1: Bool@InstantMenu:Instant Menu=Yes +# example2: Text@1024x600x32:Graphics Mode=1024x600x32 +# example3: List@Npci:Kernel Flags=npci=0x2000 +# --------------------------------------------- +# type can be: Bool, Text or List +# --------------------------------------------- +# The package installer has a setting which controls what +# the user is allowed to choose. +# A) User can select every option from the list. +# B) User can select only one of the options from the list. +# Set Exclusive=False for A, or Exclusive=True for B. +# +Exclusive=False +# --------------------------------------------- +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Text@Crs1:CrsActiveConfig=1 +Text@Crs2:CrsActiveConfig=2 +Text@Crs4:CrsActiveConfig=4 +Text@Crs8:CrsActiveConfig=8 +Text@Crs16:CrsActiveConfig=16 +Text@Crs32:CrsActiveConfig=32 +Text@Crs64:CrsActiveConfig=64 +Text@Crs128:CrsActiveConfig=128 Index: trunk/package/Patches/kernelPatcher.txt =================================================================== --- trunk/package/Patches/kernelPatcher.txt (revision 0) +++ trunk/package/Patches/kernelPatcher.txt (revision 2790) @@ -0,0 +1,34 @@ +# --------------------------------------------- +# Chameleon Optional Settings List. +# --------------------------------------------- +# Add boot options or kernel flags to the bottom of this file. +# They will appear under the package installer's Settings menu +# in a sub menu named with the filename of this file. +# Use one file or many files - it's flexible to make it easy +# to group different options under separate sub menus. +# --------------------------------------------- +# To add boot option: Structure is: +# type@name:key=value +# example1: Bool@InstantMenu:Instant Menu=Yes +# example2: Text@1024x600x32:Graphics Mode=1024x600x32 +# example3: List@Npci:Kernel Flags=npci=0x2000 +# --------------------------------------------- +# type can be: Bool, Text or List +# --------------------------------------------- +# The package installer has a setting which controls what +# the user is allowed to choose. +# A) User can select every option from the list. +# B) User can select only one of the options from the list. +# Set Exclusive=False for A, or Exclusive=True for B. +# +Exclusive=False +# --------------------------------------------- +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Bool@KernelBooter_kexts:KernelBooter_kexts=Yes +Bool@KernelPm:KernelPm=Yes +Bool@KernelLapicError:KernelLapicError=Yes +Bool@KernelLapicVersion:KernelLapicVersion=Yes +Bool@KernelHaswell:KernelHaswell=Yes +Bool@KernelcpuFamily:KernelcpuFamily=Yes +Bool@KernelSSE3:KernelSSE3=Yes Index: trunk/package/Scripts/Main/ESPpostinstall =================================================================== --- trunk/package/Scripts/Main/ESPpostinstall (revision 2789) +++ trunk/package/Scripts/Main/ESPpostinstall (revision 2790) @@ -292,7 +292,8 @@ else echo "Extra folder already exist on ${choicedVolume}, copying to the Ram Disk.." cp -R "${choicedVolume}/Extra" "${v_mntpt}"/ - ./clean_bootplist.pl "${v_mntpt}" + ./clean_bootplist.pl "${v_mntpt}" org.chameleon.Boot.plist + ./clean_bootplist.pl "${v_mntpt}" kernel.plist fi } # -------------------------------------------------------------------------------------------------------- Index: trunk/package/Scripts/Main/Standardpostinstall =================================================================== --- trunk/package/Scripts/Main/Standardpostinstall (revision 2789) +++ trunk/package/Scripts/Main/Standardpostinstall (revision 2790) @@ -292,7 +292,8 @@ else echo "Extra folder already exist on ${choicedVolume}, copying to the Ram Disk.." cp -R "${choicedVolume}/Extra" "${v_mntpt}"/ - ./clean_bootplist.pl "${v_mntpt}" + ./clean_bootplist.pl "${v_mntpt}" org.chameleon.Boot.plist + ./clean_bootplist.pl "${v_mntpt}" kernel.plist fi } # -------------------------------------------------------------------------------------------------------- Index: trunk/package/bin/po4a/po4a-normalize =================================================================== --- trunk/package/bin/po4a/po4a-normalize (revision 2789) +++ trunk/package/bin/po4a/po4a-normalize (revision 2790) @@ -119,19 +119,19 @@ my ($mastchar); Getopt::Long::Configure('no_auto_abbrev','no_ignore_case'); GetOptions( - 'help|h' => \$help, - 'help-format' => \$help_fmt, - 'format|f=s' => \$type, + 'help|h' => \$help, + 'help-format' => \$help_fmt, + 'format|f=s' => \$type, - 'blank|b' => \$blank, + 'blank|b' => \$blank, - 'master-charset|M=s' => \$mastchar, + 'master-charset|M=s' => \$mastchar, - 'option|o=s' => \@options, + 'option|o=s' => \@options, - 'verbose|v' => \$verbose, - 'debug|d' => \$debug, - 'version|V' => \&show_version + 'verbose|v' => \$verbose, + 'debug|d' => \$debug, + 'version|V' => \&show_version ) or pod2usage(); $help && pod2usage (-verbose => 1, -exitval => 0); @@ -143,9 +143,9 @@ "debug" => $debug); foreach (@options) { if (m/^([^=]*)=(.*)$/) { - $options{$1}="$2"; + $options{$1}="$2"; } else { - $options{$_}=1; + $options{$_}=1; } } @@ -159,20 +159,20 @@ $parser->{TT}{file_in_charset} = $mastchar; $parser->parse(); if ($blank) { - foreach my $msgid (keys %{$parser->{TT}{po_out}{po}}) { - if ($msgid =~ m/\n$/s) { - $parser->{TT}{po_out}{po}{$msgid}{'msgstr'} = "\n"; - } else { - $parser->{TT}{po_out}{po}{$msgid}{'msgstr'} = " "; - } - } - my $empty_po = $parser->{TT}{po_out}; - $parser = Locale::Po4a::Chooser::new($type,%options); - $parser->{TT}{po_in} = $empty_po; - $parser->read($filename); - $parser->{TT}{utf_mode} = 1; - $parser->{TT}{file_in_charset} = $mastchar; - $parser->parse(); + foreach my $msgid (keys %{$parser->{TT}{po_out}{po}}) { + if ($msgid =~ m/\n$/s) { + $parser->{TT}{po_out}{po}{$msgid}{'msgstr'} = "\n"; + } else { + $parser->{TT}{po_out}{po}{$msgid}{'msgstr'} = " "; + } + } + my $empty_po = $parser->{TT}{po_out}; + $parser = Locale::Po4a::Chooser::new($type,%options); + $parser->{TT}{po_in} = $empty_po; + $parser->read($filename); + $parser->{TT}{utf_mode} = 1; + $parser->{TT}{file_in_charset} = $mastchar; + $parser->parse(); } $parser->write('po4a-normalize.output'); $parser->writepo('po4a-normalize.po'); Index: trunk/package/bin/po4a/po4a-updatepo =================================================================== --- trunk/package/bin/po4a/po4a-updatepo (revision 2789) +++ trunk/package/bin/po4a/po4a-updatepo (revision 2790) @@ -174,6 +174,8 @@ use Pod::Usage qw(pod2usage); use File::Temp; +use File::Copy qw(copy); +use Config; Locale::Po4a::Common::textdomain('po4a'); @@ -195,27 +197,27 @@ my $noprevious; my $msgmerge_opt = ""; GetOptions('help|h' => \$help, - 'help-format' => \$help_fmt, + 'help-format' => \$help_fmt, - 'master|m=s' => \@masterfiles, - 'po|p=s' => \@pofiles, - 'format|f=s' => \$format, + 'master|m=s' => \@masterfiles, + 'po|p=s' => \@pofiles, + 'format|f=s' => \$format, - 'master-charset|M=s' => \$mastchar, + 'master-charset|M=s' => \$mastchar, - 'option|o=s' => \@options, + 'option|o=s' => \@options, - 'no-previous' => \$noprevious, - 'previous' => \$previous, - 'msgmerge-opt=s' => \$msgmerge_opt, - 'copyright-holder=s' => \$copyright_holder, - 'msgid-bugs-address=s'=> \$msgid_bugs_address, - 'package-name=s' => \$package_name, - 'package-version=s' => \$package_version, + 'no-previous' => \$noprevious, + 'previous' => \$previous, + 'msgmerge-opt=s' => \$msgmerge_opt, + 'copyright-holder=s' => \$copyright_holder, + 'msgid-bugs-address=s'=> \$msgid_bugs_address, + 'package-name=s' => \$package_name, + 'package-version=s' => \$package_version, - 'verbose|v' => \$verbose, - 'debug|d' => \$debug, - 'version|V' => \&show_version) + 'verbose|v' => \$verbose, + 'debug|d' => \$debug, + 'version|V' => \&show_version) or pod2usage(); $help && pod2usage (-verbose => 1, -exitval => 0); @@ -223,6 +225,7 @@ pod2usage () if scalar @masterfiles < 1 || scalar @pofiles < 1; $msgmerge_opt .= " --previous" unless $noprevious; +$msgmerge_opt =~ s/^\s+//; my %options = ( "verbose" => $verbose, @@ -234,9 +237,9 @@ foreach (@options) { if (m/^([^=]*)=(.*)$/) { - $options{$1}="$2"; + $options{$1}="$2"; } else { - $options{$_}=1; + $options{$_}=1; } } @@ -245,14 +248,14 @@ map { -e $_ || die wrap_msg(gettext("File %s does not exist."), $_) } @masterfiles; map { die wrap_msg(gettext("po4a-updatepo can't take the input PO from stdin.")) - if $_ eq '-' && !-e '-'} @pofiles; + if $_ eq '-' && !-e '-'} @pofiles; my ($pot_filename); -(undef,$pot_filename)=File::Temp->tempfile("po4a-updatepoXXXX", - DIR => "/tmp", - SUFFIX => ".pot", - OPEN => 0, - UNLINK => 0) +(undef,$pot_filename)=File::Temp::tempfile("po4a-updatepoXXXX", + DIR => $ENV{TMPDIR} || "/tmp", + SUFFIX => ".pot", + OPEN => 0, + UNLINK => 0) or die wrap_msg(gettext("Can't create a temporary POT file: %s"), $!); @@ -261,28 +264,31 @@ $doc->{TT}{utf_mode} = 1; $doc->process('file_in_name' => \@masterfiles, - 'file_in_charset' => $mastchar, - 'po_out_name' => $pot_filename, - 'debug' => $debug, - 'verbose' => $verbose); + 'file_in_charset' => $mastchar, + 'po_out_name' => $pot_filename, + 'debug' => $debug, + 'verbose' => $verbose); print STDERR wrap_msg(gettext("done.")) if $verbose; while (my $po_filename=shift @pofiles) { if (-e $po_filename) { - print STDERR wrap_msg(gettext("Updating %s:"), $po_filename) - if $verbose; - my $cmd = "msgmerge $msgmerge_opt -U $po_filename $pot_filename"; - system ($cmd) == 0 - or die wrap_msg(gettext("Error while running msgmerge: %s"), $!); - system "msgfmt --statistics -v -o /dev/null $po_filename" - if $verbose; + print STDERR wrap_msg(gettext("Updating %s:"), $po_filename) + if $verbose; + my @cmd = ("msgmerge".$Config{_exe}); + push (@cmd, split(/\s+/, $msgmerge_opt)) if length($msgmerge_opt); + push @cmd, ("-U", $po_filename, $pot_filename); + system (@cmd) == 0 + or die wrap_msg(gettext("Error while running msgmerge: %s"), $!); + @cmd = ("msgfmt".$Config{_exe}, "--statistics", "-v", "-o", File::Spec->devnull(), $po_filename); + system (@cmd) + if $verbose; } else { - print STDERR wrap_msg(gettext("Creating %s:"), $po_filename) - if $verbose; - system ("cp",$pot_filename,$po_filename) == 0 - or die wrap_msg(gettext("Error while copying the PO file: %s"), $!); + print STDERR wrap_msg(gettext("Creating %s:"), $po_filename) + if $verbose; + copy ($pot_filename,$po_filename) + or die wrap_msg(gettext("Error while copying the PO file: %s"), $!); } } Index: trunk/package/bin/po4a/po4a =================================================================== --- trunk/package/bin/po4a/po4a (revision 2789) +++ trunk/package/bin/po4a/po4a (revision 2790) @@ -142,7 +142,7 @@ [po4a_paths] doc/l10n/project.doc.pot $lang:doc/l10n/$lang.po -You can also use B<$master> to refer to the document basename. In this case, +You can also use B<$master> to refer to the document filename. In this case, B will use a split mode: one POT and one PO (for each language) will be created for each document specified in the B configuration file. See the B section. @@ -253,7 +253,7 @@ If you must specify the same options for multiple files, you may be interested in defining a module alias. This can be done this way: -[po4a_alias:test] man opt:"-k 21" opt_es:"-o debug=splitargs" + [po4a_alias:test] man opt:"-k 21" opt_es:"-o debug=splitargs" This defines a module alias named B, based on the B module, with the B<-k 21> applied to all the languages and with B<-o debug=splitargs> @@ -261,7 +261,7 @@ This module alias can then be use like a regular module: -[type:test] data-05/test2_man.1 $lang:tmp/test2_man.$lang.1 \ + [type:test] data-05/test2_man.1 $lang:tmp/test2_man.$lang.1 \ opt_it:"-L UTF-8" opt_fr:-v Note that you can specify additional options on a per file basis. @@ -279,6 +279,15 @@ and removes the fuzzy tag in one PO, the translation of this string will be updated in every POs automatically. +If there are name conflicts because several files have the same filename, +the name of the master file can be specified by adding a CI +option: + + [po4a_langs] de fr ja + [po4a_paths] l10n/po/$master.pot $lang:l10n/po/$master.$lang.po + [type: xml] foo/gui.xml $lang:foo/gui.$lang.xml master:file=foo-gui + [type: xml] bar/gui.xml $lang:bar/gui.$lang.xml master:file=bar-gui + =head1 OPTIONS =over 4 @@ -402,6 +411,37 @@ Every occurrence of I<$(var)> will be replaced by I. This option can be used multiple times. +=item B<--srcdir> I + +Set the base directory for all input documents specified in the B +configuration file. + +=item B<--destdir> I + +Set the base directory for all the output documents specified in the B +configuration file. + +=back + +=head2 OPTIONS WHICH MODIFY POT HEADER + +=over 4 + +=item B I[,B|B] + +Specify the reference format. Argument I can be one of B to not +produce any reference, B to not specify the line number (more +accurately all line numbers are replaced by 1), B to replace line +number by an increasing counter, and B to include complete +references. + +Argument can be followed by a comma and either B or B keyword. +References are written by default on a single line. The B option wraps +references on several lines, to mimic B tools (B and +B). This option will become the default in a future release, because +it is more sensible. The B option is available so that users who want +to keep the old behavior can do so. + =item B<--msgid-bugs-address> I Set the report address for msgid bugs. By default, the created POT files @@ -420,6 +460,12 @@ Set the package version for the POT header. The default is "VERSION". +=back + +=head2 OPTIONS TO MODIFY PO FILES + +=over 4 + =item B<--msgmerge-opt> I Extra options for B. @@ -436,16 +482,6 @@ This option adds B<--previous> to the options passed to B. It requires B 0.16 or later, and is activated by default. -=item B<--srcdir> I - -Set the base directory for all input documents specified in the B -configuration file. - -=item B<--destdir> I - -Set the base directory for all the output documents specified in the B -configuration file. - =back =head2 EXAMPLE @@ -557,6 +593,7 @@ use File::Spec; use Fcntl; # sysopen flags use Cwd; # cwd +use Config; Locale::Po4a::Common::textdomain('po4a'); @@ -601,6 +638,7 @@ "options" => {"verbose" => 0, "debug" => 0}, "variables" => {}, "partial" => [], + "porefs" => "full", "copyright-holder"=> undef, "msgid-bugs-address"=> undef, "package-name" => undef, @@ -632,6 +670,7 @@ 'version|V' => \&show_version, 'option|o=s' => \@options, 'variable=s' => \@variables, + 'porefs=s' => \$opts{"porefs"}, 'copyright-holder=s' => \$opts{"copyright-holder"}, 'msgid-bugs-address=s' => \$opts{"msgid-bugs-address"}, 'package-name=s' => \$opts{"package-name"}, @@ -804,223 +843,228 @@ my $main = ($args=~ s/^(\S+) *// ? $1 : ""); if (@langs) { - # Expand the $lang templates - my($args2) = ""; - foreach my $arg (split(/ /,$args)) { - if ( $arg =~ /\$lang\b/ ) { - # Expand for all the langs - foreach my $lang (@langs) { - my($arg2) = $arg; - $arg2 =~ s/\$lang\b/$lang/g; - $args2 .= $arg2." "; - } - } else { - # Leave the argument as is - $args2 .= $arg." "; - } - } - $args = $args2; + # Expand the $lang templates + my($args2) = ""; + foreach my $arg (split(/ /,$args)) { + if ( $arg =~ /\$lang\b/ ) { + # Expand for all the langs + foreach my $lang (@langs) { + my($arg2) = $arg; + $arg2 =~ s/\$lang\b/$lang/g; + $args2 .= $arg2." "; + } + } else { + # Leave the argument as is + $args2 .= $arg." "; + } + } + $args = $args2; } print "cmd=[$cmd]; main=$main; args=\"$args\"\n" if $po4a_opts{"debug"}; if ($cmd eq "po4a_paths") { - die wrap_ref_mod("$config_file:$nb", "", - gettext("'%s' redeclared"), "po4a_path") - if (length $pot_filename); - $pot_filename = $main; - foreach my $arg (split(/ /,$args)) { - die wrap_ref_mod("$config_file:$nb", "", - gettext("Unparsable argument '%s'."), $arg) - unless ($arg =~ /^([^:]*):(.*)/); - $po_filename{$1}=$2 if $1 ne '$lang'; - } + die wrap_ref_mod("$config_file:$nb", "", + gettext("'%s' redeclared"), "po4a_path") + if (length $pot_filename); + $pot_filename = $main; + foreach my $arg (split(/ /,$args)) { + die wrap_ref_mod("$config_file:$nb", "", + gettext("Unparsable argument '%s'."), $arg) + unless ($arg =~ /^([^:]*):(.*)/); + $po_filename{$1}=$2 if $1 ne '$lang'; + } } elsif ($cmd eq "po4a_langs") { - die wrap_ref_mod("$config_file:$nb", "", - gettext("'%s' redeclared"), "po4a_langs") - if (@langs); - @langs = split(/ /,$main." ".$args); + die wrap_ref_mod("$config_file:$nb", "", + gettext("'%s' redeclared"), "po4a_langs") + if (@langs); + @langs = split(/ /,$main." ".$args); } elsif ($cmd eq "po_directory") { - die wrap_ref_mod("$config_file:$nb", "", - gettext("The list of languages cannot be set twice.")) - if scalar @langs; - die wrap_ref_mod("$config_file:$nb", "", - gettext("The POT file cannot be set twice.")) - if length $pot_filename; + die wrap_ref_mod("$config_file:$nb", "", + gettext("The list of languages cannot be set twice.")) + if scalar @langs; + die wrap_ref_mod("$config_file:$nb", "", + gettext("The POT file cannot be set twice.")) + if length $pot_filename; - chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); - my $po_directory = $main; - die wrap_ref_mod("$config_file:$nb", "", - gettext("'%s' is not a directory"), $po_directory) - unless (-d $po_directory); - opendir PO_DIR, $po_directory - or die wrap_ref_mod("$config_file:$nb", "", - gettext("Cannot list the '%s' directory"), $po_directory); + chdir $po4a_opts{"srcdir"} + if (defined $po4a_opts{"srcdir"}); + my $po_directory = $main; + die wrap_ref_mod("$config_file:$nb", "", + gettext("'%s' is not a directory"), $po_directory) + unless (-d $po_directory); + opendir PO_DIR, $po_directory + or die wrap_ref_mod("$config_file:$nb", "", + gettext("Cannot list the '%s' directory"), $po_directory); - foreach my $f (readdir PO_DIR) { - next unless -f "$po_directory/$f"; - if ($f =~ m/^(.*)\.po$/) { - push @langs, $1; - $po_filename{$1} = "$po_directory/$f"; - } - if ($f =~ m/\.pot$/) { - if (length $pot_filename) { - die wrap_ref_mod("$config_file:$nb", "", - gettext("too many POT files: %s %s"), - $pot_filename, "$po_directory/$f"); - } else { - $pot_filename = "$po_directory/$f"; - } - } - } + foreach my $f (readdir PO_DIR) { + next unless -f "$po_directory/$f"; + if ($f =~ m/^(.*)\.po$/) { + push @langs, $1; + $po_filename{$1} = "$po_directory/$f"; + } + if ($f =~ m/\.pot$/) { + if (length $pot_filename) { + die wrap_ref_mod("$config_file:$nb", "", + gettext("too many POT files: %s %s"), + $pot_filename, "$po_directory/$f"); + } else { + $pot_filename = "$po_directory/$f"; + } + } + } - if (not @langs) { - warn wrap_ref_mod("$config_file:$nb", "", - gettext("no PO files found in %s"), $po_directory); - } + if (not @langs) { + warn wrap_ref_mod("$config_file:$nb", "", + gettext("no PO files found in %s"), $po_directory); + } - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"srcdir"}); } elsif ($cmd =~ m/type: *(.*)/) { - chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); + chdir $po4a_opts{"srcdir"} + if (defined $po4a_opts{"srcdir"}); - if (defined $document{$main}{'format'}) { - warn wrap_ref_mod("$config_file:$nb", "", - gettext("The '%s' master file was specified earlier in the ". - "configuration file. This may cause problems with ". - "options."), $main) - unless ($po4a_opts{"quiet"}); - } elsif (not -e $main) { - die wrap_ref_mod("$config_file:$nb", "", - gettext("The '%s' master file does not exist."), $main); - } - if (scalar @{$po4a_opts{"partial"}}) { - foreach my $file (@{$po4a_opts{"partial"}}) { - if ($args =~ m/(\S+):\Q$file\E\b/) { - $partial{'lang'}{$1} = 1; - $partial{'master'}{$main} = 1; - $partial{'files'}{$file} = 1; - last; - } - } - } - $document{$main}{'format'} = $1; - $document{$main}{'pos'} = $doc_count; - $doc_count++; + if (defined $document{$main}{'format'}) { + warn wrap_ref_mod("$config_file:$nb", "", + gettext("The '%s' master file was specified earlier in the ". + "configuration file. This may cause problems with ". + "options."), $main) + unless ($po4a_opts{"quiet"}); + } elsif (not -e $main) { + die wrap_ref_mod("$config_file:$nb", "", + gettext("The '%s' master file does not exist."), $main); + } + if (scalar @{$po4a_opts{"partial"}}) { + foreach my $file (@{$po4a_opts{"partial"}}) { + if ($args =~ m/(\S+):\Q$file\E\b/) { + $partial{'lang'}{$1} = 1; + $partial{'master'}{$main} = 1; + $partial{'files'}{$file} = 1; + last; + } + } + } + $document{$main}{'format'} = $1; + $document{$main}{'pos'} = $doc_count; + $doc_count++; - # Options - my %options; - # 1. Use the global options ([opt] ...) - %options = %{$document{''}{'options'}} - if defined $document{''}{'options'}; + # Options + my %options; + # 1. Use the global options ([opt] ...) + %options = %{$document{''}{'options'}} + if defined $document{''}{'options'}; - # 2. Merge the alias options - if (defined $aliases{$1}) { - $document{$main}{'format'} = $aliases{$1}{"module"}; - if (defined $aliases{$1}{"options"}) { - %options = %{$aliases{$1}{"options"}}; # XXX not a merge, but overwrite - } - } + # 2. Merge the alias options + if (defined $aliases{$1}) { + $document{$main}{'format'} = $aliases{$1}{"module"}; + if (defined $aliases{$1}{"options"}) { + %options = %{$aliases{$1}{"options"}}; # XXX not a merge, but overwrite + } + } - # 3. If this file was already specified, reuse the previous - # options (no merge) - %options = %{$document{$main}{'options'}} - if defined $document{$main}{'options'}; + # 3. If this file was already specified, reuse the previous + # options (no merge) + %options = %{$document{$main}{'options'}} + if defined $document{$main}{'options'}; - # 4. Merge the document specific options - # separate the end of the line, which contains options. - # Something more clever could be done to allow options in the - # middle of a line. - if ($args =~ m/^(.*?) +(opt(_.+)?:(.*))$/) { - $args = $1; - $args = "" unless defined $args; - $args .= " ".parse_config_options("$config_file:$nb", - $2, \%options); - } - %{$document{$main}{'options'}} = %options; + # 4. Handle "master:file=" flags for "$master" substitution in strings + if ($args =~ s/ +master:file=(\S+)//) { + $document{$main}{'master'} = $1; + } - my %discarded = (); - my @remaining_args = split(/ /,$args); - while (@remaining_args) { - my $arg = shift(@remaining_args); - die wrap_ref_mod("$config_file:$nb", "", - gettext("Unparsable argument '%s' (%s)."), $arg, $line) - unless ($arg =~ /^([^:]*):(.*)/); - my ($lang,$trans)=($1,$2); - die wrap_ref_mod("$config_file:$nb", "", - gettext("The translated and master file are the same.")) - if ($main eq $trans); + # 5. Merge the document specific options + # separate the end of the line, which contains options. + # Something more clever could be done to allow options in the + # middle of a line. + if ($args =~ m/^(.*?) +(opt(_.+)?:(.*))$/) { + $args = $1; + $args = "" unless defined $args; + $args .= " ".parse_config_options("$config_file:$nb", + $2, \%options); + } + %{$document{$main}{'options'}} = %options; - if ($lang =~ /^add_/) { - my $modifiers; - $trans =~ s/^([@!?]+)// and $modifiers = $1; - next if defined($discarded{$trans}); - if (defined $modifiers) { - if ($modifiers =~ m/!/) { - $discarded{$trans} = 1; - next; - } - next if ($modifiers =~ m/\?/ and not -e $trans); - if ($modifiers =~ m/@/) { - open LIST,"<","$trans" or die wrap_msg(gettext("Can't open %s: %s"), $trans, $!); - my @new_list = (); - while() { - chomp; - s/\s+$//; - next if length($_) == 0 or $_ =~ m/^\s*#/; - while (m/\$\((\w+)\)/) { - if (defined $po4a_opts{"variables"}{$1}) { - s/\$\((\Q$1\E)\)/$po4a_opts{"variables"}{$1}/g; - } else { - die wrap_ref_mod("$config_file:$nb", "", - gettext("Unknown variable: %s"), $1); - } - } - push(@new_list, "$lang:$_"); - } - close LIST; - unshift(@remaining_args, @new_list); - } else { - push @{$document{$main}{$lang}},$trans; - } - } else { - push @{$document{$main}{$lang}},$trans; - } - } else { - die wrap_ref_mod("$config_file:$nb", "", - gettext("Translation of %s in %s redefined"), $main, $lang) - if (defined $document{$main}{$lang}); - $document{$main}{$lang} = $trans; - } - } - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + my %discarded = (); + my @remaining_args = split(/ /,$args); + while (@remaining_args) { + my $arg = shift(@remaining_args); + die wrap_ref_mod("$config_file:$nb", "", + gettext("Unparsable argument '%s' (%s)."), $arg, $line) + unless ($arg =~ /^([^:]*):(.*)/); + my ($lang,$trans)=($1,$2); + die wrap_ref_mod("$config_file:$nb", "", + gettext("The translated and master file are the same.")) + if ($main eq $trans); + + if ($lang =~ /^add_/) { + my $modifiers; + $trans =~ s/^([@!?]+)// and $modifiers = $1; + next if defined($discarded{$trans}); + if (defined $modifiers) { + if ($modifiers =~ m/!/) { + $discarded{$trans} = 1; + next; + } + next if ($modifiers =~ m/\?/ and not -e $trans); + if ($modifiers =~ m/@/) { + open LIST,"<","$trans" or die wrap_msg(gettext("Can't open %s: %s"), $trans, $!); + my @new_list = (); + while() { + chomp; + s/\s+$//; + next if length($_) == 0 or $_ =~ m/^\s*#/; + while (m/\$\((\w+)\)/) { + if (defined $po4a_opts{"variables"}{$1}) { + s/\$\((\Q$1\E)\)/$po4a_opts{"variables"}{$1}/g; + } else { + die wrap_ref_mod("$config_file:$nb", "", + gettext("Unknown variable: %s"), $1); + } + } + push(@new_list, "$lang:$_"); + } + close LIST; + unshift(@remaining_args, @new_list); + } else { + push @{$document{$main}{$lang}},$trans; + } + } else { + push @{$document{$main}{$lang}},$trans; + } + } else { + die wrap_ref_mod("$config_file:$nb", "", + gettext("Translation of %s in %s redefined"), $main, $lang) + if (defined $document{$main}{$lang}); + $document{$main}{$lang} = $trans; + } + } + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"srcdir"}); } elsif ($cmd =~ m/po4a_alias: *(.*)/) { - my $name = $1; - my %alias = (); - $alias{"module"} = $main; - my %options; - $args = parse_config_options("$config_file:$nb", $args, \%options); - %{$alias{"options"}} = %options; - %{$aliases{$name}} = %alias; + my $name = $1; + my %alias = (); + $alias{"module"} = $main; + my %options; + $args = parse_config_options("$config_file:$nb", $args, \%options); + %{$alias{"options"}} = %options; + %{$aliases{$name}} = %alias; } elsif ($cmd eq "options") { - my %options; - my $o = $line; - $o =~ s/.*?\[options\] +//; - if (defined $document{''}{"options"}) { - %options = %{$document{''}{"options"}}; - } - parse_config_options("$config_file:$nb", - $o, - \%options); - %{$document{''}{"options"}} = %options; + my %options; + my $o = $line; + $o =~ s/.*?\[options\] +//; + if (defined $document{''}{"options"}) { + %options = %{$document{''}{"options"}}; + } + parse_config_options("$config_file:$nb", + $o, + \%options); + %{$document{''}{"options"}} = %options; } else { - die wrap_ref_mod("$config_file:$nb", "", - gettext("Unparsable command '%s'."), $cmd); + die wrap_ref_mod("$config_file:$nb", "", + gettext("Unparsable command '%s'."), $cmd); } $line = ""; @@ -1076,7 +1120,7 @@ } foreach my $master (keys %document) { next if ($master eq ''); - my $m = basename $master; + my $m = $document{$master}{"master"} || basename $master; my $master_pot = $pot_filename; $master_pot =~ s/\$master/$m/g; $split_pot{$master} = $master_pot; @@ -1128,7 +1172,7 @@ if ($update_pot_file and $po4a_opts{"verbose"}); } else { print wrap_msg(gettext("Creating %s:"), $pot_filename) - if $po4a_opts{"verbose"}; + if $po4a_opts{"verbose"}; $update_pot_file = 1; } chdir $po4a_opts{"calldir"} @@ -1136,23 +1180,16 @@ } } -my %Po_opts; -if (defined $po4a_opts{'msgid-bugs-address'}) { - $Po_opts{'msgid-bugs-address'} = $po4a_opts{'msgid-bugs-address'}; -} -if (defined $po4a_opts{'copyright-holder'}) { - $Po_opts{'copyright-holder'} = $po4a_opts{'copyright-holder'}; -} -if (defined $po4a_opts{'package-name'}) { - $Po_opts{'package-name'} = $po4a_opts{'package-name'}; -} -if (defined $po4a_opts{'package-version'}) { - $Po_opts{'package-version'} = $po4a_opts{'package-version'}; -} if ($update_pot_file) { chdir $po4a_opts{"srcdir"} if (defined $po4a_opts{"srcdir"}); - my $potfile=Locale::Po4a::Po->new(\%Po_opts); + my %pot_options; + foreach (qw(porefs msgid-bugs-address copyright-holder package-name package-version)) { + if (defined $po4a_opts{$_}) { + $pot_options{$_} = $po4a_opts{$_}; + } + } + my $potfile=Locale::Po4a::Po->new(\%pot_options); chdir $po4a_opts{"calldir"} if (defined $po4a_opts{"srcdir"}); foreach my $master (sort { return -1 if ($a eq ""); @@ -1185,10 +1222,10 @@ $potfile = $doc->getpoout(); } chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); if ($po4a_opts{"split"}) { - (undef,$pot_filename)=File::Temp->tempfile("po4aXXXX", - DIR => "/tmp", + (undef,$pot_filename)=File::Temp::tempfile("po4aXXXX", + DIR => $ENV{TMPDIR} || "/tmp", SUFFIX => ".pot", OPEN => 0, UNLINK => 0) @@ -1203,7 +1240,7 @@ } } chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); print wrap_msg(gettext(" (%d entries)"), $potfile->count_entries()) unless ($po4a_opts{"quiet"}); @@ -1217,8 +1254,8 @@ # Create a temporary POT, and check if the old one needs to be # updated (unless --force was specified). unless ($po4a_opts{"force"}) { - (undef,$tmp_file)=File::Temp->tempfile("po4aXXXX", - DIR => "/tmp", + (undef,$tmp_file)=File::Temp::tempfile("po4aXXXX", + DIR => $ENV{TMPDIR} || "/tmp", SUFFIX => ".pot", OPEN => 0, UNLINK => 0) @@ -1234,7 +1271,7 @@ or die wrap_msg(gettext("Can't create directory '%s': %s"), $dir, $!); } - my $cmd = "msggrep -N '$master' -o ". + my $cmd = "msggrep".$Config{_exe}." -N '$master' -o ". ($po4a_opts{"force"}?$split_pot{$master}:$tmp_file). " $pot_filename"; run_cmd($cmd); @@ -1248,8 +1285,8 @@ # Generate a complete .po foreach my $lang (sort keys %po_filename) { my $tmp_bigpo; - (undef,$tmp_bigpo)=File::Temp->tempfile("po4aXXXX", - DIR => "/tmp", + (undef,$tmp_bigpo)=File::Temp::tempfile("po4aXXXX", + DIR => $ENV{TMPDIR} || "/tmp", SUFFIX => "-$lang.po", OPEN => 0, UNLINK => 0) @@ -1258,7 +1295,7 @@ my $cmd_cat = ""; foreach my $master (keys %document) { next if ($master eq ''); - my $m = basename $master; + my $m = $document{$master}{"master"} || basename $master; my $master_po = $po_filename{$lang}; $master_po =~ s/\$master/$m/g; if (-e "$master_po") { @@ -1267,7 +1304,7 @@ $split_po{$lang}{$master} = $master_po; } if (length $cmd_cat) { - $cmd_cat = "msgcat -o $tmp_bigpo $cmd_cat"; + $cmd_cat = "msgcat".$Config{_exe}." -o $tmp_bigpo $cmd_cat"; run_cmd($cmd_cat); } # We do not need to keep the original name with $master @@ -1280,30 +1317,31 @@ if (not scalar @{$po4a_opts{"partial"}}) { foreach $lang (sort keys %po_filename) { chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); if (-e $po_filename{$lang}) { - print wrap_msg(gettext("Updating %s:")." ", $po_filename{$lang}) - if ($po4a_opts{"verbose"}); - my $msgmerge_opt = $po4a_opts{"msgmerge-opt"}; - $msgmerge_opt =~ s/\$lang\b/$lang/g if scalar @langs; - my $cmd = "msgmerge -U ".$po_filename{$lang}." $pot_filename ".$msgmerge_opt." --backup=none"; - run_cmd($cmd); - system "msgfmt --statistics -v -o /dev/null ".$po_filename{$lang} - if $po4a_opts{"verbose"}; + print wrap_msg(gettext("Updating %s:")." ", $po_filename{$lang}) + if ($po4a_opts{"verbose"}); + my $msgmerge_opt = $po4a_opts{"msgmerge-opt"}; + $msgmerge_opt =~ s/\$lang\b/$lang/g if scalar @langs; + my $cmd = "msgmerge".$Config{_exe}." -U ".$po_filename{$lang}." $pot_filename ".$msgmerge_opt." --backup=none"; + run_cmd($cmd); + my @cmd = ("msgfmt".$Config{_exe}, "--statistics", "-v", "-o", File::Spec->devnull(), $po_filename{$lang}); + system (@cmd) + if $po4a_opts{"verbose"}; } else { - print wrap_msg(gettext("Creating %s:"), $po_filename{$lang}) - if $po4a_opts{"verbose"}; - my $cmd = "msginit -i $pot_filename --locale $lang -o ".$po_filename{$lang}." --no-translator"; - run_cmd($cmd); + print wrap_msg(gettext("Creating %s:"), $po_filename{$lang}) + if $po4a_opts{"verbose"}; + my $cmd = "msginit".$Config{_exe}." -i $pot_filename --locale $lang -o ".$po_filename{$lang}." --no-translator"; + run_cmd($cmd); } chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); } } if ($po4a_opts{"split"}) { chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); # We don't need the tmp big POT anymore unlink($pot_filename); @@ -1314,8 +1352,8 @@ my $tmp_file; # Create a temporary PO, and check if the old one needs to be # updated (unless --force was specified). - (undef,$tmp_file)=File::Temp->tempfile("po4aXXXX", - DIR => "/tmp", + (undef,$tmp_file)=File::Temp::tempfile("po4aXXXX", + DIR => $ENV{TMPDIR} || "/tmp", SUFFIX => ".po", OPEN => 0, UNLINK => 0) @@ -1326,11 +1364,11 @@ # Create an empty PO or copy the original PO header. # This permits to keep the header. if (-f $split_po{$lang}{$master}) { - $cmd = "msggrep --force-po -v -K -e '.'". + $cmd = "msggrep".$Config{_exe}." --force-po -v -K -e '.'". " -o ".$tmp_file. " ".$split_po{$lang}{$master}; } else { - $cmd = "msginit --no-translator -l ".$lang. + $cmd = "msginit".$Config{_exe}." --no-translator -l ".$lang. " -i ".$split_pot{$master}. " -o ".$tmp_file; } @@ -1338,7 +1376,7 @@ # Update the PO according to the new POT and to the big PO # (compendium). - $cmd = "msgmerge -U -C ".$po_filename{$lang}. + $cmd = "msgmerge".$Config{_exe}." -U -C ".$po_filename{$lang}. " --backup=none ".$po4a_opts{"msgmerge-opt"}. " $tmp_file ".$split_pot{$master}; run_cmd($cmd); @@ -1364,30 +1402,30 @@ } } chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); } if (not $po4a_opts{"no-translations"}) { # update all translations foreach $lang (sort keys %po_filename) { - # Read the $lang PO once, no options for the creation - my $po = Locale::Po4a::Po->new(); - chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); - $po->read($po_filename{$lang}); - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + # Read the $lang PO once, no options for the creation + my $po = Locale::Po4a::Po->new(); + chdir $po4a_opts{"srcdir"} + if (defined $po4a_opts{"srcdir"}); + $po->read($po_filename{$lang}); + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"srcdir"}); - DOC: foreach my $master (sort { return -1 if ($a eq ""); - return 1 if ($b eq ""); - $document{$a}{'pos'} <=> - $document{$b}{'pos'} } keys %document) { - next if ($master eq ''); - next unless defined $document{$master}{$lang}; - if (scalar @{$po4a_opts{"partial"}}) { - next unless defined $partial{'files'}{$document{$master}{$lang}}; - } + DOC: foreach my $master (sort { return -1 if ($a eq ""); + return 1 if ($b eq ""); + $document{$a}{'pos'} <=> + $document{$b}{'pos'} } keys %document) { + next if ($master eq ''); + next unless defined $document{$master}{$lang}; + if (scalar @{$po4a_opts{"partial"}}) { + next unless defined $partial{'files'}{$document{$master}{$lang}}; + } unless ($po4a_opts{"force"}) { chdir $po4a_opts{"destdir"} @@ -1421,135 +1459,135 @@ if (defined $po4a_opts{"srcdir"}); } - my %file_opts = %po4a_opts; - my $options = ""; - if (defined $document{$master}{"options"}{"global"}) { - $options .= $document{$master}{"options"}{"global"}; - } - # append the language options - if (defined $document{$master}{"options"}{$lang}) { - $options .= " ".$document{$master}{"options"}{$lang}; - } - if (defined $options) { - # also use the options provided on the command line - %file_opts = get_options(@ORIGINAL_ARGV, - split_opts($options)); - } - my $doc=Locale::Po4a::Chooser::new($document{$master}{'format'}, - %{$file_opts{"options"}}); + my %file_opts = %po4a_opts; + my $options = ""; + if (defined $document{$master}{"options"}{"global"}) { + $options .= $document{$master}{"options"}{"global"}; + } + # append the language options + if (defined $document{$master}{"options"}{$lang}) { + $options .= " ".$document{$master}{"options"}{$lang}; + } + if (defined $options) { + # also use the options provided on the command line + %file_opts = get_options(@ORIGINAL_ARGV, + split_opts($options)); + } + my $doc=Locale::Po4a::Chooser::new($document{$master}{'format'}, + %{$file_opts{"options"}}); - my @file_in_name; - push @file_in_name, $master; + my @file_in_name; + push @file_in_name, $master; - # Reuse the already parsed PO, do not use the po_in_name + # Reuse the already parsed PO, do not use the po_in_name # option of process. - $doc->{TT}{po_in} = $po; - $doc->{TT}{po_in}->stats_clear(); + $doc->{TT}{po_in} = $po; + $doc->{TT}{po_in}->stats_clear(); - $doc->process('file_in_name' => \@file_in_name, - 'file_out_name' => $document{$master}{$lang}, - 'file_in_charset' => $file_opts{"mastchar"}, - 'file_out_charset' => $file_opts{"locchar"}, - 'addendum_charset' => $file_opts{"addchar"}, - 'srcdir' => $po4a_opts{"srcdir"}, - 'destdir' => $po4a_opts{"destdir"}, - 'calldir' => $po4a_opts{"calldir"}); + $doc->process('file_in_name' => \@file_in_name, + 'file_out_name' => $document{$master}{$lang}, + 'file_in_charset' => $file_opts{"mastchar"}, + 'file_out_charset' => $file_opts{"locchar"}, + 'addendum_charset' => $file_opts{"addchar"}, + 'srcdir' => $po4a_opts{"srcdir"}, + 'destdir' => $po4a_opts{"destdir"}, + 'calldir' => $po4a_opts{"calldir"}); - my ($percent,$hit,$queries) = $doc->stats(); + my ($percent,$hit,$queries) = $doc->stats(); - if ($percent<$file_opts{"threshold"}) { - print wrap_msg(gettext("Discard %s (%s of %s strings; only %s%% translated; need %s%%)."), - $document{$master}{$lang}, $hit, $queries, - $percent, $file_opts{"threshold"}); - chdir $po4a_opts{"destdir"} - if (defined $po4a_opts{"destdir"}); - unlink($document{$master}{$lang}) if (-e $document{$master}{$lang}); - unless ($po4a_opts{"force"}) { - if ($po4a_opts{"stamp"}) { - touch($document{$master}{$lang}.".po4a-stamp"); - print wrap_msg(gettext("Timestamp %s created."), - $document{$master}{$lang}.".po4a-stamp") - if ($po4a_opts{"verbose"}); - } - } - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"destdir"}); - next DOC; - } - unless ($po4a_opts{"force"}) { - chdir $po4a_opts{"destdir"} - if (defined $po4a_opts{"destdir"}); - if (-e $document{$master}{$lang}.".po4a-stamp") { - unlink $document{$master}{$lang}.".po4a-stamp"; - print wrap_msg(gettext("Timestamp %s removed."), - $document{$master}{$lang}.".po4a-stamp") - if ($po4a_opts{"verbose"}); - } - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"destdir"}); - } + if ($percent<$file_opts{"threshold"}) { + print wrap_msg(gettext("Discard %s (%s of %s strings; only %s%% translated; need %s%%)."), + $document{$master}{$lang}, $hit, $queries, + $percent, $file_opts{"threshold"}); + chdir $po4a_opts{"destdir"} + if (defined $po4a_opts{"destdir"}); + unlink($document{$master}{$lang}) if (-e $document{$master}{$lang}); + unless ($po4a_opts{"force"}) { + if ($po4a_opts{"stamp"}) { + touch($document{$master}{$lang}.".po4a-stamp"); + print wrap_msg(gettext("Timestamp %s created."), + $document{$master}{$lang}.".po4a-stamp") + if ($po4a_opts{"verbose"}); + } + } + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"destdir"}); + next DOC; + } + unless ($po4a_opts{"force"}) { + chdir $po4a_opts{"destdir"} + if (defined $po4a_opts{"destdir"}); + if (-e $document{$master}{$lang}.".po4a-stamp") { + unlink $document{$master}{$lang}.".po4a-stamp"; + print wrap_msg(gettext("Timestamp %s removed."), + $document{$master}{$lang}.".po4a-stamp") + if ($po4a_opts{"verbose"}); + } + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"destdir"}); + } - if (defined ($document{$master}{"add_$lang"})) { - chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); - foreach my $add (@{$document{$master}{"add_$lang"}}) { - if ( !$doc->addendum($add) ) { - die wrap_msg(gettext("Addendum %s does NOT apply to %s (translation discarded)."), - $add, $document{$master}{$lang}); - chdir $po4a_opts{"destdir"} - if (defined $po4a_opts{"destdir"}); - unlink($document{$master}{$lang}) if (-e $document{$master}{$lang}); - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"destdir"}); - next DOC; - } - } - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); - } - if ($file_opts{"verbose"}) { - if ($percent == 100) { - print wrap_msg(gettext("%s is %s%% translated (%s strings)."), - $document{$master}{$lang}, $percent, $queries); - } else { - print wrap_msg(gettext("%s is %s%% translated (%s of %s strings)."), - $document{$master}{$lang}, $percent, $hit, $queries); - } - } + if (defined ($document{$master}{"add_$lang"})) { + chdir $po4a_opts{"srcdir"} + if (defined $po4a_opts{"srcdir"}); + foreach my $add (@{$document{$master}{"add_$lang"}}) { + if ( !$doc->addendum($add) ) { + die wrap_msg(gettext("Addendum %s does NOT apply to %s (translation discarded)."), + $add, $document{$master}{$lang}); + chdir $po4a_opts{"destdir"} + if (defined $po4a_opts{"destdir"}); + unlink($document{$master}{$lang}) if (-e $document{$master}{$lang}); + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"destdir"}); + next DOC; + } + } + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"srcdir"}); + } + if ($file_opts{"verbose"}) { + if ($percent == 100) { + print wrap_msg(gettext("%s is %s%% translated (%s strings)."), + $document{$master}{$lang}, $percent, $queries); + } else { + print wrap_msg(gettext("%s is %s%% translated (%s of %s strings)."), + $document{$master}{$lang}, $percent, $hit, $queries); + } + } - chdir $po4a_opts{"destdir"} - if (defined $po4a_opts{"destdir"}); - $doc->write($document{$master}{$lang}); - chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"destdir"}); - } + chdir $po4a_opts{"destdir"} + if (defined $po4a_opts{"destdir"}); + $doc->write($document{$master}{$lang}); + chdir $po4a_opts{"calldir"} + if (defined $po4a_opts{"destdir"}); + } } } if ($po4a_opts{"split"}) { chdir $po4a_opts{"srcdir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); # We don't need the tmp big POs anymore foreach $lang (keys %po_filename) { unlink $po_filename{$lang}; } chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"srcdir"}); + if (defined $po4a_opts{"srcdir"}); } if ($po4a_opts{"rm-translations"}) { # Delete the translated documents chdir $po4a_opts{"destdir"} - if (defined $po4a_opts{"destdir"}); + if (defined $po4a_opts{"destdir"}); foreach $lang (keys %po_filename) { - foreach my $master (keys %document) { - next if ($master eq ''); - unlink $document{$master}{$lang}; - unlink $document{$master}{$lang}.".po4a-stamp"; - } + foreach my $master (keys %document) { + next if ($master eq ''); + unlink $document{$master}{$lang}; + unlink $document{$master}{$lang}.".po4a-stamp"; + } } chdir $po4a_opts{"calldir"} - if (defined $po4a_opts{"destdir"}); + if (defined $po4a_opts{"destdir"}); } sub touch { Index: trunk/package/bin/po4a/lib/Locale/Po4a/Man.pm =================================================================== --- trunk/package/bin/po4a/lib/Locale/Po4a/Man.pm (revision 2789) +++ trunk/package/bin/po4a/lib/Locale/Po4a/Man.pm (revision 2790) @@ -1968,12 +1968,8 @@ # corresponding UE command. # When generating HTML this should translate into the HTML command #   -$macro{'UR'}=sub { - return untranslated(@_) - if (defined($_[2]) && $_[2] eq ':'); - return translate_joined(@_); -}; -$macro{'UE'}=\&noarg; +$inline{'UR'}=1; +$inline{'UE'}=1; $macro{'UN'}=\&translate_joined; # Miscellaneous Macros @@ -2481,10 +2477,6 @@ $macro{'In'} = \&translate_mdoc; # NetBSD Macro $inline{'Nx'} = 1; - # Curly brackets - $inline{'Brq'} = 1; - # Corporate name - $inline{'%Q'} = 1; # Math symbol $inline{'Ms'} = 1; # Prints 'under development' Index: trunk/package/bin/po4a/lib/Locale/Po4a/LaTeX.pm =================================================================== --- trunk/package/bin/po4a/lib/Locale/Po4a/LaTeX.pm (revision 2789) +++ trunk/package/bin/po4a/lib/Locale/Po4a/LaTeX.pm (revision 2790) @@ -188,7 +188,7 @@ register_generic_command("*newfont,{}{}"); register_generic_command("*newlength,{}"); register_generic_command("*newsavebox,{}"); -register_generic_command("*newtheorem,{}{_}"); # Two forms, the optionnal arg is not the first one +register_generic_command("*newtheorem,{}[]{_}[]"); # Two forms, {}[]{_} or {}{_}[] register_generic_command("nocite,{}"); register_generic_command("nolinebreak,[]"); register_generic_command("*nopagebreak,[]"); Index: trunk/package/bin/po4a/lib/Locale/Po4a/AsciiDoc.pm =================================================================== --- trunk/package/bin/po4a/lib/Locale/Po4a/AsciiDoc.pm (revision 0) +++ trunk/package/bin/po4a/lib/Locale/Po4a/AsciiDoc.pm (revision 2790) @@ -0,0 +1,879 @@ +#!/usr/bin/perl -w + +=encoding UTF-8 + +=head1 NAME + +Locale::Po4a::AsciiDoc - convert AsciiDoc documents from/to PO files + +=head1 DESCRIPTION + +The po4a (PO for anything) project goal is to ease translations (and more +interestingly, the maintenance of translations) using gettext tools on +areas where they were not expected like documentation. + +Locale::Po4a::AsciiDoc is a module to help the translation of documentation in +the AsciiDoc format. + +=cut + +package Locale::Po4a::AsciiDoc; + +use 5.010; +use strict; +use warnings; + +require Exporter; +use vars qw(@ISA @EXPORT); +@ISA = qw(Locale::Po4a::TransTractor); +@EXPORT = qw(); + +use Locale::Po4a::TransTractor; +use Locale::Po4a::Common; + +=head1 OPTIONS ACCEPTED BY THIS MODULE + +These are this module's particular options: + +=over + +=item B + +The name of a file containing definitions for po4a, as defined in the +B section. +You can use this option if it is not possible to put the definitions in +the document being translated. + +In a definitions file, lines must not start by two slashes, but directly +by B. + +=item B + +Space-separated list of attribute entries you want to translate. By default, +no attribute entries are translatable. + +=item B + +Space-separated list of macro definitions. + +=item B